From 32966cbc621264de088bc9b06cf74de22dfac2f4 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 5 Aug 2023 13:24:37 +0300 Subject: [PATCH] add "give badge" button to profiles for easier badging --- files/routes/admin.py | 2 +- files/templates/admin/badge_admin.html | 3 ++- files/templates/userpage/admintools.html | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index d26fcd308f..38f81b1b5a 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -455,7 +455,7 @@ def admin_badges_grantable_list(v): @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @admin_level_required(PERMS['USER_BADGES']) def badge_grant_get(v): - grant = request.url.endswith("grant") + grant = request.path.endswith("grant") badge_types = admin_badges_grantable_list(v) return render_template("admin/badge_admin.html", v=v, diff --git a/files/templates/admin/badge_admin.html b/files/templates/admin/badge_admin.html index f76142608a..289f94e7c6 100644 --- a/files/templates/admin/badge_admin.html +++ b/files/templates/admin/badge_admin.html @@ -42,7 +42,8 @@ {% endfor %} - +{% set usernames = request.values.get('usernames') %} + {% if grant %} diff --git a/files/templates/userpage/admintools.html b/files/templates/userpage/admintools.html index 2e91ae1a7e..7c7f038326 100644 --- a/files/templates/userpage/admintools.html +++ b/files/templates/userpage/admintools.html @@ -85,6 +85,10 @@ {% endif %}
+ {% if FEATURES['BADGES'] and v.admin_level >= PERMS['USER_BADGES'] %} + Give Badge + {% endif %} + {% if v.admin_level >= PERMS['ADMIN_ADD'] and not u.admin_level %} {% endif %}