0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Avoid knex warning when destroying a user

no issue

- the warning is "Transaction was already complete"
- destroying a user happens in a transaction, but the event is not asynchronous
  - so we have to ensure that we don't operate on a finished transaction
This commit is contained in:
kirrg001 2018-01-27 12:05:16 +01:00
parent b4f355f713
commit c6f30a46d2

View file

@ -31,9 +31,9 @@ common.events.on('user.deactivated', function (userModel, options) {
return;
}
models.Accesstoken.destroyByUser(options)
models.Accesstoken.destroyByUser(_.omit(options, 'transacting'))
.then(function () {
return models.Refreshtoken.destroyByUser(options);
return models.Refreshtoken.destroyByUser(_.omit(options, 'transacting'));
})
.catch(function (err) {
common.logging.error(new common.errors.GhostError({