Limit associations fetch when loading token

This commit is contained in:
Chocobozzz 2018-09-20 10:13:13 +02:00
parent fcc7c06037
commit 91411dba92
No known key found for this signature in database
GPG key ID: 583A612D890159BE
11 changed files with 75 additions and 80 deletions

View file

@ -267,15 +267,9 @@ async function updateUser (req: express.Request, res: express.Response, next: ex
const user = await userToUpdate.save()
// Destroy user token to refresh rights
if (roleChanged) {
await OAuthTokenModel.deleteUserToken(userToUpdate.id)
}
if (roleChanged) await OAuthTokenModel.deleteUserToken(userToUpdate.id)
auditLogger.update(
getAuditIdFromRes(res),
new UserAuditView(user.toFormattedJSON()),
oldUserAuditView
)
auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()), oldUserAuditView)
// Don't need to send this update to followers, these attributes are not propagated
@ -343,9 +337,5 @@ async function changeUserBlock (res: express.Response, user: UserModel, block: b
await Emailer.Instance.addUserBlockJob(user, block, reason)
auditLogger.update(
getAuditIdFromRes(res),
new UserAuditView(user.toFormattedJSON()),
oldUserAuditView
)
auditLogger.update(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()), oldUserAuditView)
}