forked from rDrama/rDrama
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
ad0f60bf68
|
@ -41,6 +41,7 @@ def send_notification(vid, user, text, db=None):
|
|||
notif = Notification(comment_id=new_comment.id,
|
||||
user_id=uid)
|
||||
db.add(notif)
|
||||
db.commit()
|
||||
|
||||
|
||||
def send_follow_notif(vid, user, text):
|
||||
|
|
|
@ -191,7 +191,7 @@ def get_awards(v):
|
|||
|
||||
user_awards = v.awards
|
||||
for val in return_value:
|
||||
val['owned'] = len([x for x in user_awards if x.kind == val['kind'] and not x.given])
|
||||
val['owned'] = user_awards.filter_by(kind=val['kind'], submission_id=None, comment_id=None).count()
|
||||
|
||||
return jsonify(return_value)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ GIPHY_KEY = environ.get('GIPHY_KEY').rstrip()
|
|||
|
||||
@app.route("/giphy", methods=["GET"])
|
||||
@app.route("/giphy<path>", methods=["GET"])
|
||||
def giphy():
|
||||
def giphy(path=None):
|
||||
|
||||
searchTerm = request.args.get("searchTerm", "")
|
||||
limit = int(request.args.get("limit", 48))
|
||||
|
@ -19,4 +19,4 @@ def giphy():
|
|||
url = f"https://api.giphy.com/v1/gifs/search?q={searchTerm}&api_key={GIPHY_KEY}&limit=48"
|
||||
else:
|
||||
url = f"https://api.giphy.com/v1/gifs?api_key={GIPHY_KEY}&limit=48"
|
||||
return jsonify(requests.get(url).json())
|
||||
return jsonify(requests.get(url).json())
|
||||
|
|
|
@ -131,12 +131,10 @@ 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()
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, receiver, transfer_message)
|
||||
|
||||
return {"message": f"{app.config['COINS_NAME']} transferred!"}
|
||||
|
||||
|
|
|
@ -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}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue