]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-channel.ts
Move subscription helper in the account line
[github/Chocobozzz/PeerTube.git] / server / models / video / video-channel.ts
index 6567b00d69475bc9037218442740eff6a1f2345c..33a19f0ff224706503bbde130c56aa22fb651f2c 100644 (file)
@@ -1,15 +1,27 @@
 import {
-  AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table,
-  UpdatedAt, Default, DataType
+  AllowNull,
+  BeforeDestroy,
+  BelongsTo,
+  Column,
+  CreatedAt,
+  DataType,
+  Default,
+  DefaultScope,
+  ForeignKey,
+  HasMany,
+  Is,
+  Model,
+  Scopes,
+  Table,
+  UpdatedAt
 } from 'sequelize-typescript'
 import { ActivityPubActor } from '../../../shared/models/activitypub'
 import { VideoChannel } from '../../../shared/models/videos'
 import {
-  isVideoChannelDescriptionValid, isVideoChannelNameValid,
+  isVideoChannelDescriptionValid,
+  isVideoChannelNameValid,
   isVideoChannelSupportValid
 } from '../../helpers/custom-validators/video-channels'
-import { logger } from '../../helpers/logger'
-import { sendDeleteActor } from '../../lib/activitypub/send'
 import { AccountModel } from '../account/account'
 import { ActorModel } from '../activitypub/actor'
 import { getSort, throwIfNotValid } from '../utils'
@@ -139,13 +151,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
       instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
     }
 
-    if (instance.Actor.isOwned()) {
-      logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url)
-
-      return sendDeleteActor(instance.Actor, options.transaction)
-    }
-
-    return undefined
+    return instance.Actor.destroy({ transaction: options.transaction })
   }
 
   static countByAccount (accountId: number) {