fix dramacoin transfers

why the fuck are there 3 duplicates of post_toast and who broke mine
master
atrc445 2021-09-16 22:18:03 +02:00
parent e8afa57299
commit 57bf5867a6
2 changed files with 2 additions and 16 deletions

View File

@ -131,13 +131,12 @@ def transfer_coins(v, username):
receiver.coins += amount
g.db.add(receiver)
g.db.add(v)
g.db.commit()
transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
send_notification(v.id, receiver, transfer_message)
return {"message": f"{amount} {app.config['COINS_NAME']} transferred!"}, 200
g.db.commit()
return {"message": f"{app.config['COINS_NAME']} transferred!"}

View File

@ -62,20 +62,7 @@
t.disabled = true;
post_toast("/@{{u.username}}/transfer_coins",
xhr => {
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"])
}
},
false,
{"amount": document.getElementById(mobile ? "coins-transfer-amount-mobile" : "coins-transfer-amount").value}
);