diff --git a/files/routes/front.py b/files/routes/front.py index a8f3cc035..f7a87f029 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -462,4 +462,18 @@ def all_comments(v): idlist = idlist[:25] if request.headers.get("Authorization"): return {"data": [x.json for x in comments]} - return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file + return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) + + +@app.get("/transfers") +@auth_required +def transfers(v): + + page = int(request.values.get("page", 1)) + + comments = g.db.query(Comment).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.distinguish_level == 6, Comment.body_html.like("% has transferred %"), Comment.created_utc == 0).offset(25 * (page - 1)).limit(26).all() + + next_exists = len(comments) > 25 + comments = comments[:25] + + return render_template("home_comments.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file diff --git a/files/routes/users.py b/files/routes/users.py index b5f389586..142ba995b 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -244,11 +244,13 @@ def transfer_coins(v, username): tax = math.ceil(amount*0.03) tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).one_or_none() tax_receiver.coins += tax - log_message = f"[@{v.username}](/id/{v.id}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.id})" - send_repeatable_notification(TAX_RECEIVER_ID, log_message) g.db.add(tax_receiver) else: tax = 0 + if TAX_RECEIVED_ID: + log_message = f"[@{v.username}](/id/{v.id}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.id})" + send_repeatable_notification(TAX_RECEIVER_ID, log_message) + receiver.coins += amount-tax v.coins -= amount send_repeatable_notification(receiver.id, f"🤑 [@{v.username}](/id/{v.id}) has gifted you {amount-tax} {app.config['COINS_NAME']}!") diff --git a/files/templates/home_comments.html b/files/templates/home_comments.html index ceb3bc208..018d90e2f 100644 --- a/files/templates/home_comments.html +++ b/files/templates/home_comments.html @@ -4,54 +4,54 @@ {% block sortnav %}{% endblock %} {% block content %} -

-	
+ {% if request.path != '/transfers' %} +
-
-
‎
-