aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.ts
diff options
context:
space:
mode:
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 {