diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-30 13:39:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-30 13:39:20 +0200 |
commit | c5a893d5363ce1fd681751cf48977086a35d5724 (patch) | |
tree | beeb87ea2c8309b43118bc45d48ff09f38b42ea9 /server/models/video | |
parent | b7f5b524756e8a30c396ae40a262884766ef6554 (diff) | |
download | PeerTube-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')
-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) { |