aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-30 11:33:58 +0200
committerChocobozzz <me@florianbigard.com>2018-07-30 11:34:34 +0200
commite04551d796adf69703a41af123207b2624237292 (patch)
treee5e306785e417d66cb60a1dcff7fe038dd2049cf /server/models/account/account.ts
parente20015d744fe9d637bfa6924194f54eecbbd6722 (diff)
downloadPeerTube-e04551d796adf69703a41af123207b2624237292.tar.gz
PeerTube-e04551d796adf69703a41af123207b2624237292.tar.zst
PeerTube-e04551d796adf69703a41af123207b2624237292.zip
Delete actor too when deleting account/video channel
Diffstat (limited to 'server/models/account/account.ts')
-rw-r--r--server/models/account/account.ts21
1 files changed, 7 insertions, 14 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 2eed66fc2..ce0f3f7c5 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -16,8 +16,6 @@ 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'
21import { ActorModel } from '../activitypub/actor' 19import { ActorModel } from '../activitypub/actor'
22import { ApplicationModel } from '../application/application' 20import { ApplicationModel } from '../application/application'
23import { AvatarModel } from '../avatar/avatar' 21import { AvatarModel } from '../avatar/avatar'
@@ -138,12 +136,7 @@ export class AccountModel extends Model<AccountModel> {
138 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel 136 instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
139 } 137 }
140 138
141 if (instance.isOwned()) { 139 return instance.Actor.destroy({ transaction: options.transaction })
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
147 } 140 }
148 141
149 static load (id: number) { 142 static load (id: number) {
@@ -246,12 +239,12 @@ export class AccountModel extends Model<AccountModel> {
246 } 239 }
247 240
248 return AccountModel.findAndCountAll(query) 241 return AccountModel.findAndCountAll(query)
249 .then(({ rows, count }) => { 242 .then(({ rows, count }) => {
250 return { 243 return {
251 data: rows, 244 data: rows,
252 total: count 245 total: count
253 } 246 }
254 }) 247 })
255 } 248 }
256 249
257 toFormattedJSON (): Account { 250 toFormattedJSON (): Account {