remotes/1693045480750635534/spooky-22
Aevann1 2021-10-29 04:32:23 +02:00
parent 15fce3230a
commit 94e2c9a334
5 changed files with 17 additions and 23 deletions

View File

@ -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:

View File

@ -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",

View File

@ -176,13 +176,9 @@
<div class="user-info">
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.id}}')"></span>
{% if standalone and c.over_18 %}<span class="badge badge-danger">+18</span> {% 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 %}
</div>
<div id="comment-banned-warning" class="comment-text text-danger text-small">
{% if c.is_banned and c.ban_reason %}Reason: {{c.ban_reason}}{% endif %}
</div>
</div>
@ -309,7 +305,7 @@
{% endif %}
{% if c.is_banned and c.ban_reason %}
<div id="comment-banned-warning" class="comment-text text-danger text-small mb-0">Reason: {{c.ban_reason}}</div>
<div id="comment-banned-warning" class="comment-text text-danger text-small mb-0">removed by @{{c.ban_reason}}</div>
{% endif %}
<div id="comment-text-{{c.id}}" class="comment-text mb-0">

View File

@ -508,6 +508,12 @@
</div>
{% endfor %}
{% if p.is_banned and p.ban_reason %}
<div class="text-danger text-small mb-0">removed by @{{p.ban_reason}}</div>
{% endif %}
</div>

View File

@ -12,7 +12,7 @@
{% block title %}
<title>{{p.plaintitle(v)}}</title>
{% if p.is_banned %}
<meta name="description" content="[removed by admins]">
<meta name="description" content="removed by @{{p.ban_reason}}">
{% else %}
<meta name="description" content="[deleted by user]">
{% endif %}
@ -54,9 +54,9 @@
<div id="post-{{p.id}}" class="card d-flex flex-row-reverse flex-nowrap justify-content-end border-0 p-0 {% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}">
<div class="card-block my-md-auto{% if p.is_banned %} banned{% endif %}">
<div class="post-meta text-left d-md-none mb-1">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}[Removed by admins]{% else %}[Deleted by user]{% endif %}</div>
<div class="post-meta text-left d-md-none mb-1">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}removed by @{{p.ban_reason}}{% else %}[Deleted by user]{% endif %}</div>
<h5 class="card-title post-title text-left mb-0 mb-md-1">{{p.plaintitle(v)}}</h5>
<div class="post-meta text-left d-none d-md-block">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}[Removed by admins]{% else %}[Deleted by user]{% endif %}</div>
<div class="post-meta text-left d-none d-md-block">{% if p.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}{% if p.is_banned %}removed by @{{p.ban_reason}}{% else %}[Deleted by user]{% endif %}</div>
</div>
@ -72,9 +72,6 @@
</div>
</div>
{% if p.is_banned and p.ban_reason %}
<div class="text-danger mt-4 mb-2">Reason: {{p.ban_reason | safe}}</div>
{% endif %}
{% if v and v.admin_level >=3 and p.body_html %}
<div class="post-body mt-4 mb-2">
{{p.body_html | safe}}