aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-30 13:39:20 +0200
committerChocobozzz <me@florianbigard.com>2018-07-30 13:39:20 +0200
commitc5a893d5363ce1fd681751cf48977086a35d5724 (patch)
treebeeb87ea2c8309b43118bc45d48ff09f38b42ea9 /server/models/video/video-channel.ts
parentb7f5b524756e8a30c396ae40a262884766ef6554 (diff)
downloadPeerTube-c5a893d5363ce1fd681751cf48977086a35d5724.tar.gz
PeerTube-c5a893d5363ce1fd681751cf48977086a35d5724.tar.zst
PeerTube-c5a893d5363ce1fd681751cf48977086a35d5724.zip
Revert "Delete actor too when deleting account/video channel"
This reverts commit e04551d796adf69703a41af123207b2624237292. See https://github.com/Chocobozzz/PeerTube/issues/870#issuecomment-408814420
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) {