From 81b0b438cca08490604da20853ed32ed29d203ac Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 1 Dec 2021 17:37:36 +0200 Subject: [PATCH] fsdsdf --- files/routes/admin.py | 17 +++++------------ files/templates/comments.html | 4 ++-- files/templates/submission.html | 4 ++-- files/templates/submission_banned.html | 2 +- files/templates/submission_listing.html | 4 ++-- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 08abf81eb..edd32391e 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1016,8 +1016,7 @@ def api_ban_comment(c_id, v): def api_unban_comment(c_id, v): comment = g.db.query(Comment).filter_by(id=c_id).first() - if not comment: - abort(404) + if not comment: abort(404) g.db.add(comment) if comment.is_banned: @@ -1037,26 +1036,20 @@ def api_unban_comment(c_id, v): @app.post("/distinguish_comment/") -@auth_required +@admin_level_required(1) def admin_distinguish_comment(c_id, v): - if v.admin_level == 0: abort(403) comment = get_comment(c_id, v=v) - if comment.author_id != v.id: - abort(403) + if comment.author_id != v.id: abort(403) comment.distinguish_level = 0 if comment.distinguish_level else v.admin_level g.db.add(comment) - html=render_template( - "comments.html", - v=v, - comments=[comment], - ) + html = render_template("comments.html", v=v, comments=[comment]) - html=str(BeautifulSoup(html, features="html.parser").find(id=f"comment-{comment.id}-only")) + html = str(BeautifulSoup(html, features="html.parser").find(id=f"comment-{comment.id}-only")) g.db.commit() diff --git a/files/templates/comments.html b/files/templates/comments.html index 9fa8d87ea..6c8e60533 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -397,7 +397,7 @@ {% endif %} {% endif %} - {% if v and v.admin_level > 1 and v.id==c.author_id %} + {% if v and v.admin_level > 0 and v.id==c.author_id %} Undistinguish Distinguish {% endif %} @@ -574,7 +574,7 @@ {% endif %} {% if v %} - {% if v.admin_level > 1 and v.id==c.author_id %} + {% if v.admin_level > 0 and v.id==c.author_id %} Distinguish Undistinguish {% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index e79c39309..08e42ec3e 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -289,7 +289,7 @@ {% endif %} - {% if v.admin_level > 1 %} + {% if v.admin_level > 0 %} {% if v==p.author %} @@ -583,7 +583,7 @@ Delete {% endif %} {% endif %} - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level > 0 %} Pin Unpin {% if v==p.author %} diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html index 7f591e9e4..03cc544ac 100644 --- a/files/templates/submission_banned.html +++ b/files/templates/submission_banned.html @@ -25,7 +25,7 @@ {% endif %} -{% if v.admin_level > 1 and v.id==p.author_id %} +{% if v.admin_level > 0 and v.id==p.author_id %}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 2cb3b0c18..68f807ca6 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -247,7 +247,7 @@ {% endif %} {% endif %} - {% if v and v.admin_level > 1 %} + {% if v and v.admin_level > 0 %} Pin Unpin {% if v==p.author %} @@ -418,7 +418,7 @@ {% endif %} - {% if v.admin_level > 1 %} + {% if v.admin_level > 0 %} {% if v==p.author %}