mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 10:12:21 +00:00
fixed gifting transaction / adding comments (#14150)
This commit is contained in:
parent
e2c6fb1ea2
commit
c9b3c48379
1 changed files with 4 additions and 1 deletions
|
|
@ -714,8 +714,11 @@ api.transferGems = {
|
|||
throw new NotAuthorized(res.t('badAmountOfGemsToSend'));
|
||||
}
|
||||
|
||||
// Received from {sender}
|
||||
await receiver.updateBalance(amount, 'gift_receive', sender._id, sender.auth.local.username);
|
||||
await sender.updateBalance(-amount, 'gift_send', sender._id, receiver.auth.local.username);
|
||||
|
||||
// Gifted to {receiver}
|
||||
await sender.updateBalance(-amount, 'gift_send', receiver._id, receiver.auth.local.username);
|
||||
// @TODO necessary? Also saved when sending the inbox message
|
||||
const promises = [receiver.save(), sender.save()];
|
||||
await Promise.all(promises);
|
||||
|
|
|
|||
Loading…
Reference in a new issue