From f0816853da21126b7ee8f77cad2a817aa2a9a12f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 30 Jul 2022 00:43:25 +0200 Subject: [PATCH] make ban_reason logic a little better --- files/classes/user.py | 3 ++- files/routes/admin.py | 2 -- files/templates/ban_modal.html | 2 +- files/templates/userpage.html | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 798717bb7..6b0905535 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -662,7 +662,8 @@ class User(Base): elif self.discord_id: remove_user(self) self.is_banned = admin.id if admin else AUTOJANNY_ID - if reason: self.ban_reason = reason + if reason and len(reason) <= 256: + self.ban_reason = reason diff --git a/files/routes/admin.py b/files/routes/admin.py index 68e4c8826..c58de5455 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1009,8 +1009,6 @@ def ban_user(user_id, v): if reason.startswith("/") and '\\' not in reason: reason = f'{reason}' - if len(reason) > 256: reason = reason - user.ban(admin=v, reason=reason, days=days) if request.values.get("alts"): diff --git a/files/templates/ban_modal.html b/files/templates/ban_modal.html index a5a9860cb..ce4b9ba93 100644 --- a/files/templates/ban_modal.html +++ b/files/templates/ban_modal.html @@ -15,7 +15,7 @@ - + diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 65727fef0..dde645b45 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -290,7 +290,7 @@
- +
@@ -624,7 +624,7 @@ - +