fixed double send coins... if user clicked twice.

This commit is contained in:
Paolo Arena
2022-10-13 21:10:07 +02:00
parent 58d9885ca2
commit 9f5bbb188a
8 changed files with 105 additions and 24 deletions

View File

@@ -521,10 +521,12 @@ sendNotifSchema.statics.updateStatusAndDescr = async function(myrecnotif, onlysa
typeidsearch = shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ;
newstatus = shared_consts.CircuitsNotif.STATUS_COINS_REFUSED;
} else if (myrecnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED_SENT) {
typeidsearch = shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ_SENT;
if (myrecnotif.paramsObj.extrarec.hasOwnProperty('notifIdToUpdate'))
idnotiftosearch = myrecnotif.paramsObj.extrarec.notifIdToUpdate;
newstatus = shared_consts.CircuitsNotif.STATUS_COINS_ACCEPTED_SENT;
} else if (myrecnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED_SENT) {
typeidsearch = shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ_SENT;
if (myrecnotif.paramsObj.extrarec.hasOwnProperty('notifIdToUpdate'))
idnotiftosearch = myrecnotif.paramsObj.extrarec.notifIdToUpdate;
newstatus = shared_consts.CircuitsNotif.STATUS_COINS_REFUSED_SENT;
@@ -598,8 +600,8 @@ sendNotifSchema.statics.checkIfCoinsAlreadySent = async function(notifId) {
const status = await SendNotif.getStatus(notifId);
if (status !== null) {
return (status === shared_consts.CircuitsNotif.STATUS_ACCEPTED) ||
(status === shared_consts.CircuitsNotif.STATUS_REFUSED);
return (status === shared_consts.CircuitsNotif.STATUS_COINS_ACCEPTED) ||
(status === shared_consts.CircuitsNotif.STATUS_COINS_REFUSED);
}
return true;