diff options
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/account.ts | 21 |
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' |
17 | import { Account } from '../../../shared/models/actors' | 17 | import { Account } from '../../../shared/models/actors' |
18 | import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' | 18 | import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts' |
19 | import { logger } from '../../helpers/logger' | ||
20 | import { sendDeleteActor } from '../../lib/activitypub/send' | ||
19 | import { ActorModel } from '../activitypub/actor' | 21 | import { ActorModel } from '../activitypub/actor' |
20 | import { ApplicationModel } from '../application/application' | 22 | import { ApplicationModel } from '../application/application' |
21 | import { AvatarModel } from '../avatar/avatar' | 23 | import { 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 { |