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/account/account.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'server/models/account/account.ts') diff --git a/server/models/account/account.ts b/server/models/account/account.ts index ce0f3f7c5..2eed66fc2 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -16,6 +16,8 @@ import { } from 'sequelize-typescript' import { Account } from '../../../shared/models/actors' import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' +import { logger } from '../../helpers/logger' +import { sendDeleteActor } from '../../lib/activitypub/send' import { ActorModel } from '../activitypub/actor' import { ApplicationModel } from '../application/application' import { AvatarModel } from '../avatar/avatar' @@ -136,7 +138,12 @@ export class AccountModel extends Model { instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel } - return instance.Actor.destroy({ transaction: options.transaction }) + if (instance.isOwned()) { + logger.debug('Sending delete of actor of account %s.', instance.Actor.url) + return sendDeleteActor(instance.Actor, options.transaction) + } + + return undefined } static load (id: number) { @@ -239,12 +246,12 @@ export class AccountModel extends Model { } return AccountModel.findAndCountAll(query) - .then(({ rows, count }) => { - return { - data: rows, - total: count - } - }) + .then(({ rows, count }) => { + return { + data: rows, + total: count + } + }) } toFormattedJSON (): Account { -- cgit v1.2.3