diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 35e80709c..1a035ee4e 100755 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -9,9 +9,10 @@ def get_logged_in_user(): token = request.headers.get("Authorization") if not token: return None - client = g.db.query(ClientAuth).options(lazyload('*')).filter(ClientAuth.access_token == token).first() - - x = (client.user, client) if client else (None, None) + try: + client = g.db.query(ClientAuth).options(lazyload('*')).filter(ClientAuth.access_token == token).first() + x = (client.user, client) if client else (None, None) + except: x = (None, None) else: diff --git a/files/routes/admin.py b/files/routes/admin.py index af689531b..f57133c72 100755 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -873,13 +873,7 @@ def ban_post(post_id, v): post.stickied = None post.is_pinned = False post.removed_by = v.id - - ban_reason=request.values.get("reason", "") - ban_reason = CustomRenderer().render(mistletoe.Document(ban_reason)) - ban_reason = sanitize(ban_reason) - - post.ban_reason = ban_reason - + post.ban_reason = v.username g.db.add(post) @@ -997,7 +991,7 @@ def api_ban_comment(c_id, v): comment.is_banned = True comment.is_approved = 0 comment.removed_by = v.id - + comment.ban_reason = v.username g.db.add(comment) ma=ModAction( kind="ban_comment", diff --git a/files/templates/comments.html b/files/templates/comments.html index 7836f252c..f70dea4d5 100755 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -176,13 +176,9 @@
{% if standalone and c.over_18 %}+18 {% endif %} - [{% if c.is_banned %}Removed by admins{% elif c.deleted_utc > 0 %}Deleted by author{% elif c.is_blocking %}You are blocking @{{c.author.username}}{% endif %}] + {% if c.is_banned %}removed by @{{c.ban_reason}}{% elif c.deleted_utc > 0 %}Deleted by author{% elif c.is_blocking %}You are blocking @{{c.author.username}}{% endif %}
- -
- {% if c.is_banned and c.ban_reason %}Reason: {{c.ban_reason}}{% endif %} -
@@ -309,7 +305,7 @@ {% endif %} {% if c.is_banned and c.ban_reason %} -
Reason: {{c.ban_reason}}
+
removed by @{{c.ban_reason}}
{% endif %}
diff --git a/files/templates/submission.html b/files/templates/submission.html index 8d7085071..d2f411c4d 100755 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -508,6 +508,12 @@
{% endfor %} + {% if p.is_banned and p.ban_reason %} +
removed by @{{p.ban_reason}}
+ {% endif %} + + + diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html index e2d521769..3d7145f40 100755 --- a/files/templates/submission_banned.html +++ b/files/templates/submission_banned.html @@ -12,7 +12,7 @@ {% block title %} {{p.plaintitle(v)}} {% if p.is_banned %} - + {% else %} {% endif %} @@ -54,9 +54,9 @@
- +
{{p.plaintitle(v)}}
- +
@@ -72,9 +72,6 @@
- {% if p.is_banned and p.ban_reason %} -
Reason: {{p.ban_reason | safe}}
- {% endif %} {% if v and v.admin_level >=3 and p.body_html %}
{{p.body_html | safe}}