diff options
Diffstat (limited to 'server/controllers/api/users/index.ts')
-rw-r--r-- | server/controllers/api/users/index.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 5911d1a0f..fa0688a9e 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -307,7 +307,10 @@ async function removeUser (req: express.Request, res: express.Response) { | |||
307 | 307 | ||
308 | auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) | 308 | auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) |
309 | 309 | ||
310 | await user.destroy() | 310 | await sequelizeTypescript.transaction(async t => { |
311 | // Use a transaction to avoid inconsistencies with hooks (account/channel deletion & federation) | ||
312 | await user.destroy({ transaction: t }) | ||
313 | }) | ||
311 | 314 | ||
312 | Hooks.runAction('action:api.user.deleted', { user }) | 315 | Hooks.runAction('action:api.user.deleted', { user }) |
313 | 316 | ||