diff options
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r-- | server/models/video/video-channel.ts | 30 |
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 @@ | |||
1 | import { | 1 | import { |
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' |
18 | import { ActivityPubActor } from '../../../shared/models/activitypub' | 5 | import { ActivityPubActor } from '../../../shared/models/activitypub' |
19 | import { VideoChannel } from '../../../shared/models/videos' | 6 | import { VideoChannel } from '../../../shared/models/videos' |
20 | import { | 7 | import { |
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' |
11 | import { logger } from '../../helpers/logger' | ||
12 | import { sendDeleteActor } from '../../lib/activitypub/send' | ||
25 | import { AccountModel } from '../account/account' | 13 | import { AccountModel } from '../account/account' |
26 | import { ActorModel } from '../activitypub/actor' | 14 | import { ActorModel } from '../activitypub/actor' |
27 | import { getSort, throwIfNotValid } from '../utils' | 15 | import { 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) { |