forked from MarseyWorld/MarseyWorld
make ban_reason logic a little better
parent
73e26f1946
commit
f0816853da
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1009,8 +1009,6 @@ def ban_user(user_id, v):
|
|||
if reason.startswith("/") and '\\' not in reason:
|
||||
reason = f'<a href="{reason.split()[0]}">{reason}</a>'
|
||||
|
||||
if len(reason) > 256: reason = reason
|
||||
|
||||
user.ban(admin=v, reason=reason, days=days)
|
||||
|
||||
if request.values.get("alts"):
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
|
||||
<label for="ban-modal-link">Public ban reason (optional)</label>
|
||||
<textarea autocomplete="off" maxlength="64" name="reason" form="banModalForm" class="form-control" id="ban-modal-link" aria-label="With textarea" placeholder="Enter reason"></textarea>
|
||||
<textarea autocomplete="off" maxlength="256" name="reason" form="banModalForm" class="form-control" id="ban-modal-link" aria-label="With textarea" placeholder="Enter reason"></textarea>
|
||||
|
||||
<label for="days" class="mt-3">Duration days</label>
|
||||
<input autocomplete="off" type="number" step="any" name="days" id="days" class="form-control" placeholder="leave blank for permanent">
|
||||
|
|
|
@ -290,7 +290,7 @@
|
|||
<form action="/ban_user/{{u.id}}" method="post" action="">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<input type="hidden" name="redir" value="true">
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit').disabled=false">
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit').disabled=false">
|
||||
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input autocomplete="off" type="checkbox" id="alts-2-desktop" class="custom-control-input" name="alts" value="1">
|
||||
|
@ -624,7 +624,7 @@
|
|||
<form action="/ban_user/{{u.id}}/" method="post">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<input type="hidden" name="redir" value="true">
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit2').disabled=false">
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" oninput="document.getElementById('user-ban-submit2').disabled=false">
|
||||
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||
<br >
|
||||
<div class="custom-control custom-checkbox">
|
||||
|
|
Loading…
Reference in New Issue