aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.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/account/account.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/account/account.ts')
-rw-r--r--server/models/account/account.ts21
1 files changed, 14 insertions, 7 deletions
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 {
16} from 'sequelize-typescript' 16} from 'sequelize-typescript'
17import { Account } from '../../../shared/models/actors' 17import { Account } from '../../../shared/models/actors'
18import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' 18import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts'
19import { logger } from '../../helpers/logger'
20import { sendDeleteActor } from '../../lib/activitypub/send'
19import { ActorModel } from '../activitypub/actor' 21import { ActorModel } from '../activitypub/actor'
20import { ApplicationModel } from '../application/application' 22import { ApplicationModel } from '../application/application'
21import { AvatarModel } from '../avatar/avatar' 23import { AvatarModel } from '../avatar/avatar'
@@ -136,7 +138,12 @@ export class AccountModel extends Model<AccountModel> {
136 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel 138 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
137 } 139 }
138 140
139 return instance.Actor.destroy({ transaction: options.transaction }) 141 if (instance.isOwned()) {
142 logger.debug('Sending delete of actor of account %s.', instance.Actor.url)
143 return sendDeleteActor(instance.Actor, options.transaction)
144 }
145
146 return undefined
140 } 147 }
141 148
142 static load (id: number) { 149 static load (id: number) {
@@ -239,12 +246,12 @@ export class AccountModel extends Model<AccountModel> {
239 } 246 }
240 247
241 return AccountModel.findAndCountAll(query) 248 return AccountModel.findAndCountAll(query)
242 .then(({ rows, count }) => { 249 .then(({ rows, count }) => {
243 return { 250 return {
244 data: rows, 251 data: rows,
245 total: count 252 total: count
246 } 253 }
247 }) 254 })
248 } 255 }
249 256
250 toFormattedJSON (): Account { 257 toFormattedJSON (): Account {