forked from rDrama/rDrama
fix dramacoin transfers
why the fuck are there 3 duplicates of post_toast and who broke minemaster
parent
e8afa57299
commit
57bf5867a6
|
@ -131,13 +131,12 @@ def transfer_coins(v, username):
|
||||||
receiver.coins += amount
|
receiver.coins += amount
|
||||||
g.db.add(receiver)
|
g.db.add(receiver)
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
|
transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
|
||||||
send_notification(v.id, receiver, transfer_message)
|
send_notification(v.id, receiver, transfer_message)
|
||||||
return {"message": f"{amount} {app.config['COINS_NAME']} transferred!"}, 200
|
return {"message": f"{amount} {app.config['COINS_NAME']} transferred!"}, 200
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
return {"message": f"{app.config['COINS_NAME']} transferred!"}
|
return {"message": f"{app.config['COINS_NAME']} transferred!"}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,20 +62,7 @@
|
||||||
t.disabled = true;
|
t.disabled = true;
|
||||||
|
|
||||||
post_toast("/@{{u.username}}/transfer_coins",
|
post_toast("/@{{u.username}}/transfer_coins",
|
||||||
xhr => {
|
false,
|
||||||
if(xhr.status == 200) {
|
|
||||||
fetch("/@{{u.username}}/coins")
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(m => {
|
|
||||||
document.getElementById("profile-coins-amount").innerText = m["coins"];
|
|
||||||
document.getElementById("profile-coins-amount-mobile").innerText = m["coins"];
|
|
||||||
})
|
|
||||||
|
|
||||||
fetch("/@{{v.username}}/coins")
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(m => document.getElementById(`user-coins-amount`).innerText = m["coins"])
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{"amount": document.getElementById(mobile ? "coins-transfer-amount-mobile" : "coins-transfer-amount").value}
|
{"amount": document.getElementById(mobile ? "coins-transfer-amount-mobile" : "coins-transfer-amount").value}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue