require reason for banning

master
Aevann 2022-12-28 11:31:27 +02:00
parent 5fef411e0c
commit 7b71c36e3f
1 changed files with 9 additions and 2 deletions

View File

@ -927,7 +927,11 @@ def shadowban(user_id, v):
if user.admin_level > v.admin_level:
abort(403)
user.shadowbanned = v.id
reason = request.values.get("reason").strip()[:256]
reason = request.values.get("reason", "").strip()[:256]
if not reason:
abort(400, "You need to submit a reason for shadowbanning!")
reason = filter_emojis_only(reason)
user.ban_reason = reason
g.db.add(user)
@ -1022,7 +1026,10 @@ def ban_user(user_id, v):
except:
pass
reason = request.values.get("reason").strip()[:256]
reason = request.values.get("reason", "").strip()[:256]
if not reason:
abort(400, "You need to submit a reason for banning!")
if reason.startswith("/") and '\\' not in reason:
reason = f'<a href="{reason.split()[0]}">{reason}</a>'