diff --git a/files/routes/admin.py b/files/routes/admin.py index edfb63b48..cf0b2d6eb 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -906,16 +906,19 @@ def ban_user(user_id, v): if 'reason' in request.values: if reason.startswith("/post/"): - post = reason.split("/post/")[1] - post = get_post(post) - post.bannedfor = True - g.db.add(post) + try: + post = int(reason.split("/post/")[1]) + post = get_post(post) + post.bannedfor = True + g.db.add(post) + except: pass elif reason.startswith("/comment/"): - comment = reason.split("/comment/")[1] - comment = get_comment(comment) - comment.bannedfor = True - g.db.add(comment) - + try: + comment = int(reason.split("/comment/")[1]) + comment = get_comment(comment) + comment.bannedfor = True + g.db.add(comment) + except: pass g.db.commit() if 'redir' in request.values: return (redirect(user.url), user) diff --git a/files/templates/comments.html b/files/templates/comments.html index 1804f5152..6c00eb5d0 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -549,6 +549,9 @@ {% include "emoji_modal.html" %} {% include "award_modal.html" %} {% include "delete_comment_modal.html" %} + {% if v.admin_level == 6 %} + {% include "ban_modal.html" %} + {% endif %} {% endif %} {% include "expanded_image_modal.html" %} {% include "flag_comment_modal.html" %} diff --git a/files/templates/default.html b/files/templates/default.html index 406c7f9c1..0b2d56875 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1353,21 +1353,6 @@ -{% if v %} -{% include "award_modal.html" %} -{% include "flag_post_modal.html" %} -{% include "flag_comment_modal.html" %} -{% include "gif_modal.html" %} -{% include "delete_comment_modal.html" %} -{% include "delete_post_modal.html" %} - -{% if v.admin_level > 1 %} -{% include "ban_modal.html" %} -{% endif %} - -{% endif %} - -{% include "expanded_image_modal.html" %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 284d2b246..29ec47fb3 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -520,6 +520,9 @@ {% if v %} {% include "award_modal.html" %} {% include "delete_post_modal.html" %} + {% if v.admin_level == 6 %} + {% include "ban_modal.html" %} + {% endif %} {% endif %} {% include "expanded_image_modal.html" %} -{% include "flag_post_modal.html" %} \ No newline at end of file +{% include "flag_post_modal.html" %}