From c5a893d5363ce1fd681751cf48977086a35d5724 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 30 Jul 2018 13:39:20 +0200 Subject: Revert "Delete actor too when deleting account/video channel" This reverts commit e04551d796adf69703a41af123207b2624237292. See https://github.com/Chocobozzz/PeerTube/issues/870#issuecomment-408814420 --- server/models/video/video-channel.ts | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'server/models/video/video-channel.ts') 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 @@ import { - AllowNull, - BeforeDestroy, - BelongsTo, - Column, - CreatedAt, - DataType, - Default, - DefaultScope, - ForeignKey, - HasMany, - Is, - Model, - Scopes, - Table, - UpdatedAt + AllowNull, BeforeDestroy, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, HasMany, Is, Model, Scopes, Table, + UpdatedAt, Default, DataType } from 'sequelize-typescript' import { ActivityPubActor } from '../../../shared/models/activitypub' import { VideoChannel } from '../../../shared/models/videos' import { - isVideoChannelDescriptionValid, - isVideoChannelNameValid, + isVideoChannelDescriptionValid, isVideoChannelNameValid, isVideoChannelSupportValid } from '../../helpers/custom-validators/video-channels' +import { logger } from '../../helpers/logger' +import { sendDeleteActor } from '../../lib/activitypub/send' import { AccountModel } from '../account/account' import { ActorModel } from '../activitypub/actor' import { getSort, throwIfNotValid } from '../utils' @@ -151,7 +139,13 @@ export class VideoChannelModel extends Model { instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel } - return instance.Actor.destroy({ transaction: options.transaction }) + if (instance.Actor.isOwned()) { + logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url) + + return sendDeleteActor(instance.Actor, options.transaction) + } + + return undefined } static countByAccount (accountId: number) { -- cgit v1.2.3