fdf
This commit is contained in:
parent
e8eec1792a
commit
d7c7db6619
3 changed files with 60 additions and 44 deletions
|
@ -463,3 +463,17 @@ def all_comments(v):
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in comments]}
|
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)
|
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("%</a> 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)
|
|
@ -244,11 +244,13 @@ def transfer_coins(v, username):
|
||||||
tax = math.ceil(amount*0.03)
|
tax = math.ceil(amount*0.03)
|
||||||
tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).one_or_none()
|
tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).one_or_none()
|
||||||
tax_receiver.coins += tax
|
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)
|
g.db.add(tax_receiver)
|
||||||
else: tax = 0
|
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
|
receiver.coins += amount-tax
|
||||||
v.coins -= amount
|
v.coins -= amount
|
||||||
send_repeatable_notification(receiver.id, f"🤑 [@{v.username}](/id/{v.id}) has gifted you {amount-tax} {app.config['COINS_NAME']}!")
|
send_repeatable_notification(receiver.id, f"🤑 [@{v.username}](/id/{v.id}) has gifted you {amount-tax} {app.config['COINS_NAME']}!")
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
{% block sortnav %}{% endblock %}
|
{% block sortnav %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
|
{% if request.path != '/transfers' %}
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
|
||||||
<div class="d-flex px-2 align-items-center sortingbarmargin">
|
<div class="d-flex px-2 align-items-center sortingbarmargin">
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}">
|
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}">
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue