aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-30 11:33:58 +0200
committerChocobozzz <me@florianbigard.com>2018-07-30 11:34:34 +0200
commite04551d796adf69703a41af123207b2624237292 (patch)
treee5e306785e417d66cb60a1dcff7fe038dd2049cf /server/models/video/video-channel.ts
parente20015d744fe9d637bfa6924194f54eecbbd6722 (diff)
downloadPeerTube-e04551d796adf69703a41af123207b2624237292.tar.gz
PeerTube-e04551d796adf69703a41af123207b2624237292.tar.zst
PeerTube-e04551d796adf69703a41af123207b2624237292.zip
Delete actor too when deleting account/video channel
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts30
1 files changed, 18 insertions, 12 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 6567b00d6..33a19f0ff 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,15 +1,27 @@
1import { 1import {
2 AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table, 2 AllowNull,
3 UpdatedAt, Default, DataType 3 BeforeDestroy,
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
4} from 'sequelize-typescript' 17} from 'sequelize-typescript'
5import { ActivityPubActor } from '../../../shared/models/activitypub' 18import { ActivityPubActor } from '../../../shared/models/activitypub'
6import { VideoChannel } from '../../../shared/models/videos' 19import { VideoChannel } from '../../../shared/models/videos'
7import { 20import {
8 isVideoChannelDescriptionValid, isVideoChannelNameValid, 21 isVideoChannelDescriptionValid,
22 isVideoChannelNameValid,
9 isVideoChannelSupportValid 23 isVideoChannelSupportValid
10} from '../../helpers/custom-validators/video-channels' 24} from '../../helpers/custom-validators/video-channels'
11import { logger } from '../../helpers/logger'
12import { sendDeleteActor } from '../../lib/activitypub/send'
13import { AccountModel } from '../account/account' 25import { AccountModel } from '../account/account'
14import { ActorModel } from '../activitypub/actor' 26import { ActorModel } from '../activitypub/actor'
15import { getSort, throwIfNotValid } from '../utils' 27import { getSort, throwIfNotValid } from '../utils'
@@ -139,13 +151,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
139 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel 151 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
140 } 152 }
141 153
142 if (instance.Actor.isOwned()) { 154 return instance.Actor.destroy({ transaction: options.transaction })
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
149 } 155 }
150 156
151 static countByAccount (accountId: number) { 157 static countByAccount (accountId: number) {