aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts30
1 files changed, 12 insertions, 18 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 33a19f0ff..6567b00d6 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,27 +1,15 @@
1import { 1import {
2 AllowNull, 2 AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table,
3 BeforeDestroy, 3 UpdatedAt, Default, DataType
4 BelongsTo,
5 Column,
6 CreatedAt,
7 DataType,
8 Default,
9 DefaultScope,
10 ForeignKey,
11 HasMany,
12 Is,
13 Model,
14 Scopes,
15 Table,
16 UpdatedAt
17} from 'sequelize-typescript' 4} from 'sequelize-typescript'
18import { ActivityPubActor } from '../../../shared/models/activitypub' 5import { ActivityPubActor } from '../../../shared/models/activitypub'
19import { VideoChannel } from '../../../shared/models/videos' 6import { VideoChannel } from '../../../shared/models/videos'
20import { 7import {
21 isVideoChannelDescriptionValid, 8 isVideoChannelDescriptionValid, isVideoChannelNameValid,
22 isVideoChannelNameValid,
23 isVideoChannelSupportValid 9 isVideoChannelSupportValid
24} from '../../helpers/custom-validators/video-channels' 10} from '../../helpers/custom-validators/video-channels'
11import { logger } from '../../helpers/logger'
12import { sendDeleteActor } from '../../lib/activitypub/send'
25import { AccountModel } from '../account/account' 13import { AccountModel } from '../account/account'
26import { ActorModel } from '../activitypub/actor' 14import { ActorModel } from '../activitypub/actor'
27import { getSort, throwIfNotValid } from '../utils' 15import { getSort, throwIfNotValid } from '../utils'
@@ -151,7 +139,13 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
151 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel 139 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
152 } 140 }
153 141
154 return instance.Actor.destroy({ transaction: options.transaction }) 142 if (instance.Actor.isOwned()) {
143 logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url)
144
145 return sendDeleteActor(instance.Actor, options.transaction)
146 }
147
148 return undefined
155 } 149 }
156 150
157 static countByAccount (accountId: number) { 151 static countByAccount (accountId: number) {