diff --git a/files/classes/submission.py b/files/classes/submission.py index 2658df688..0a1c3ed67 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -54,7 +54,7 @@ class Submission(Base): approved_by = relationship("User", uselist=False, primaryjoin="Submission.is_approved==User.id", viewonly=True) awards = relationship("AwardRelationship", viewonly=True) reports = relationship("Flag", viewonly=True) - comments = relationship("Comment", primaryjoin="Comment.parent_submission==Submission.id", viewonly=True) + comments = relationship("Comment", primaryjoin="Comment.parent_submission==Submission.id") def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -357,9 +357,7 @@ class Submission(Base): def realbody(self, v): if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{CC} ONLY

" - body = self.body_html - - if not body: return "" + body = self.body_html or "" body = censor_slurs(body, v) @@ -382,6 +380,29 @@ class Submission(Base): g.db.add(self.author) g.db.commit() + for o in self.options: + body += f'
' + + + for c in self.bet_options: + body += f'''
200) or self.total_bet_voted(v): body += " disabled " + body += f'''>" + if v and v.admin_level > 2: + body += f'''''' + body += "
" + + if self.author.sig_html and not self.ghost and (self.author_id == MOOSE_ID or not (v and v.sigs_disabled)): body += f"
{self.author.sig_html}" diff --git a/files/routes/awards.py b/files/routes/awards.py index 3571f1aa6..3021cdee1 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -587,74 +587,4 @@ def award_comment(cid, v): g.db.commit() if request.referrer and len(request.referrer) > 1 and request.host in request.referrer: return redirect(request.referrer) - return redirect("/") - -@app.get("/admin/awards") -@admin_level_required(2) -def admin_userawards_get(v): - - if v.admin_level != 3: - return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) - - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) - -@app.post("/admin/awards") -@limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(2) -def admin_userawards_post(v): - - try: u = request.values.get("username").strip() - except: abort(404) - - u = get_user(u, graceful=False, v=v) - - notify_awards = {} - - latest = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first() - thing = latest.id - - for key, value in request.values.items(): - if key not in AWARDS: continue - - if value: - - if int(value) > 10: abort(403) - - if int(value): notify_awards[key] = int(value) - - for x in range(int(value)): - thing += 1 - - award = AwardRelationship( - id=thing, - user_id=u.id, - kind=key - ) - - g.db.add(award) - - if v.id != u.id: - text = "You were given the following awards:\n\n" - for key, value in notify_awards.items(): - text += f" - **{value}** {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}\n" - send_repeatable_notification(u.id, text) - - note = "" - - for key, value in notify_awards.items(): - note += f"{value} {AWARDS[key]['title']}, " - - if len(note) > 256: return {"error": "You're giving too many awards at the same time!"} - - ma=ModAction( - kind="grant_awards", - user_id=v.id, - target_user_id=u.id, - _note=note[:-2] - ) - g.db.add(ma) - - g.db.commit() - - if v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file + return redirect("/") \ No newline at end of file diff --git a/files/routes/users.py b/files/routes/users.py index 037afdf78..58f074547 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -256,16 +256,10 @@ def transfer_coins(v, username): if v.coins < amount: return {"error": f"You don't have enough coins."}, 400 if amount < 100: return {"error": f"You have to gift at least 100 coins."}, 400 - if not v.patron and not receiver.patron and not v.alts_patron and not receiver.alts_patron: - 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 - g.db.add(tax_receiver) - else: tax = 0 + tax = math.ceil(amount*0.03) - if TAX_RECEIVER_ID: - log_message = f"@{v.username} has transferred {amount} coins to @{receiver.username}" - send_repeatable_notification(TAX_RECEIVER_ID, log_message) + log_message = f"@{v.username} has transferred {amount} coins to @{receiver.username}" + send_repeatable_notification(CARP_ID, log_message) receiver.coins += amount-tax v.coins -= amount @@ -295,9 +289,8 @@ def transfer_bux(v, username): if v.procoins < amount: return {"error": "You don't have enough marseybux"}, 400 if amount < 100: return {"error": "You have to gift at least 100 marseybux."}, 400 - if TAX_RECEIVER_ID: - log_message = f"@{v.username} has transferred {amount} Marseybux to @{receiver.username}" - send_repeatable_notification(TAX_RECEIVER_ID, log_message) + log_message = f"@{v.username} has transferred {amount} Marseybux to @{receiver.username}" + send_repeatable_notification(CARP_ID, log_message) receiver.procoins += amount v.procoins -= amount diff --git a/files/templates/admin/awards.html b/files/templates/admin/awards.html deleted file mode 100644 index 125082144..000000000 --- a/files/templates/admin/awards.html +++ /dev/null @@ -1,69 +0,0 @@ -{% extends "default.html" %} - -{% block title %} -Grant User Award -{% endblock %} - -{% block pagetype %}message{% endblock %} - -{% block content %} - - {% if error %} - - {% endif %} - {% if msg %} - - {% endif %} - -

-	

-	
User Award Grant
- -
- -
- - -
- - - - - - - - - {% for a in awards %} - - - - - - {% endfor %} -
IconTitleAmount
{{a['title']}}
- - - - - -

-	{% if request.host != 'rdrama.net' or v.id == AEVANN_ID %}
-		
Grant Monthly Marseybux
- {% endif %} -{% endblock %} \ No newline at end of file diff --git a/files/templates/submission.html b/files/templates/submission.html index c7ca68675..f1cc204fb 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -524,23 +524,6 @@ {% endif %} {{p.realbody(v) | safe}} - {% for c in p.options %} -
- - -
- {% endfor %} - - {% for c in p.bet_options %} -
- 200) or p.total_bet_voted(v) %}disabled{% endif %} type="radio" id="{{c.id}}" onchange="bet_vote('{{c.id}}')"> - - {% if v and v.admin_level > 2 %} - - {% endif %} -
- {% endfor %} - {% if p.is_banned and p.ban_reason %}
removed by @{{p.ban_reason}}
{% endif %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index cdd376564..452596d23 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -698,7 +698,7 @@
{{u.username}}
{% endif %} - + {% endblock %} diff --git a/files/templates/userpage_comments.html b/files/templates/userpage_comments.html index f3d7dc2c1..f382926fc 100644 --- a/files/templates/userpage_comments.html +++ b/files/templates/userpage_comments.html @@ -114,5 +114,5 @@
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file diff --git a/files/templates/userpage_private.html b/files/templates/userpage_private.html index 0a267ca8d..0867e6141 100644 --- a/files/templates/userpage_private.html +++ b/files/templates/userpage_private.html @@ -48,5 +48,5 @@
{{u.username}}
{% endif %} - + {% endblock %} \ No newline at end of file