From f924f88821255f63cb2633a3a8dc571a52d18c82 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 5 Nov 2022 04:16:39 +0200 Subject: [PATCH] make "unshadowban" button work instantly --- files/routes/admin.py | 5 +++-- files/templates/userpage_admintools.html | 27 ++++++++++-------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 1cb4cf23c..458cac1a3 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -839,7 +839,8 @@ def unagendaposter(user_id, v): @admin_level_required(PERMS['USER_SHADOWBAN']) def shadowban(user_id, v): user = get_account(user_id) - if user.admin_level != 0: abort(403) + if user.admin_level > v.admin_level: + abort(403) user.shadowbanned = v.username reason = request.values.get("reason").strip()[:256] user.ban_reason = reason @@ -886,7 +887,7 @@ def unshadowban(user_id, v): cache.delete_memoized(frontlist) - return redirect(user.url) + return {"message": f"@{user.username} has been unshadowbanned!"} @app.post("/admin/title_change/") diff --git a/files/templates/userpage_admintools.html b/files/templates/userpage_admintools.html index 11a141a3e..ce74cb4ff 100644 --- a/files/templates/userpage_admintools.html +++ b/files/templates/userpage_admintools.html @@ -57,22 +57,17 @@ {% endif %} {% if v.admin_level >= PERMS['USER_SHADOWBAN'] %} - {% if u.shadowbanned %} -
- - -
- {% else %} -
- - -
- - -
- -
- {% endif %} + + +
+ + +
+ + +
+ +
{% endif %} {% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %}