forked from MarseyWorld/MarseyWorld
increase ban reason char limit
parent
49c636d261
commit
27f5823dee
|
@ -1149,7 +1149,7 @@ class User(Base):
|
|||
|
||||
|
||||
def ban(self, admin=None, reason=None, days=0.0):
|
||||
if len(reason) > 256:
|
||||
if len(reason) > BAN_REASON_HTML_LENGTH_LIMIT:
|
||||
stop(400, "Rendered ban reason is too long!")
|
||||
|
||||
g.db.add(self)
|
||||
|
|
|
@ -920,6 +920,9 @@ HOLE_BANNER_LIMIT = 10
|
|||
BIO_FRIENDS_ENEMIES_LENGTH_LIMIT = 5000 # do not make larger without altering the table
|
||||
BIO_FRIENDS_ENEMIES_HTML_LENGTH_LIMIT = 20000 # do not make larger without altering the table
|
||||
|
||||
BAN_REASON_LENGTH_LIMIT = 500
|
||||
BAN_REASON_HTML_LENGTH_LIMIT = 5000 # do not make larger without altering the table
|
||||
|
||||
COSMETIC_AWARD_COIN_AWARD_PCT = 0.50
|
||||
|
||||
TRUESCORE_MINIMUM = 0
|
||||
|
|
|
@ -883,12 +883,12 @@ def shadowban(user_id, v):
|
|||
if not reason:
|
||||
stop(400, "You need to submit a reason for shadowbanning!")
|
||||
|
||||
if len(reason) > 256:
|
||||
stop(400, "Shadowban reason is too long (max 256 characters)")
|
||||
if len(reason) > BAN_REASON_LENGTH_LIMIT:
|
||||
stop(400, f"Shadowban reason is too long (max {BAN_REASON_LENGTH_LIMIT} characters)")
|
||||
|
||||
reason = filter_emojis_only(reason)
|
||||
|
||||
if len(reason) > 256:
|
||||
if len(reason) > BAN_REASON_HTML_LENGTH_LIMIT:
|
||||
stop(400, "Rendered shadowban reason is too long!")
|
||||
|
||||
user.shadowban_reason = reason
|
||||
|
@ -1029,12 +1029,12 @@ def ban_user(fullname, v):
|
|||
if not reason:
|
||||
stop(400, "You need to submit a reason for banning!")
|
||||
|
||||
if len(reason) > 256:
|
||||
stop(400, "Ban reason is too long (max 256 characters)")
|
||||
if len(reason) > BAN_REASON_LENGTH_LIMIT:
|
||||
stop(400, f"Ban reason is too long (max {BAN_REASON_LENGTH_LIMIT} characters)")
|
||||
|
||||
reason = filter_emojis_only(reason)
|
||||
|
||||
if len(reason) > 256:
|
||||
if len(reason) > BAN_REASON_HTML_LENGTH_LIMIT:
|
||||
stop(400, "Rendered ban reason is too long!")
|
||||
|
||||
reason = reason_regex_post.sub(r'<a href="\1">\1</a>', reason)
|
||||
|
|
|
@ -205,5 +205,5 @@ def inject_constants():
|
|||
"emoji_count":emoji_count, "group_count":group_count, "user_count":user_count,
|
||||
"HOLE_SIDEBAR_COLUMN_LENGTH":HOLE_SIDEBAR_COLUMN_LENGTH, "HOLE_SNAPPY_QUOTES_LENGTH":HOLE_SNAPPY_QUOTES_LENGTH, "USER_SNAPPY_QUOTES_LENGTH":USER_SNAPPY_QUOTES_LENGTH, "top_poster_of_the_day":top_poster_of_the_day,
|
||||
"CATEGORIES_ICONS":CATEGORIES_ICONS, "CATEGORIES_HOLES":CATEGORIES_HOLES,
|
||||
"HOLE_COST":HOLE_COST,
|
||||
"HOLE_COST":HOLE_COST, "BAN_REASON_LENGTH_LIMIT":BAN_REASON_LENGTH_LIMIT,
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<label for="ban_reason">Public ban reason (optional)</label>
|
||||
|
||||
<input autocomplete="off" id="ban_reason" class="form-control" placeholder="Enter reason" maxlength="256">
|
||||
<input autocomplete="off" id="ban_reason" class="form-control" placeholder="Enter reason" maxlength="{{BAN_REASON_LENGTH_LIMIT}}">
|
||||
|
||||
<label for="ban_days" class="mt-3">Days</label>
|
||||
<input autocomplete="off" type="number" step="any" id="ban_days" class="form-control" placeholder="Leave blank for permanent">
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
{% if v.admin_level >= PERMS['USER_BAN'] %}
|
||||
<form class="my-3 {% if u.is_permabanned %}d-none{% endif %}" action="/ban_user/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
|
||||
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-ban-submit-{{deviceType}}" required>
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="{{BAN_REASON_LENGTH_LIMIT}}" name="reason" placeholder="Ban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-ban-submit-{{deviceType}}" required>
|
||||
<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 mb-1">
|
||||
<input autocomplete="off" type="checkbox" id="alts-2-{{deviceType}}" class="custom-control-input" name="alts" value="1">
|
||||
|
@ -74,7 +74,7 @@
|
|||
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
||||
<form id="shadowban-{{deviceType}}" class="mt-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
|
||||
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-shadowban-submit-{{deviceType}}" required>
|
||||
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="{{BAN_REASON_LENGTH_LIMIT}}" name="reason" placeholder="Shadowban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-shadowban-submit-{{deviceType}}" required>
|
||||
<input autocomplete="off" id="user-shadowban-submit-{{deviceType}}" type="submit" class="btn btn-danger" value="Shadowban user" disabled>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
alter table users alter column ban_reason type varchar(5000);
|
||||
alter table users alter column shadowban_reason type varchar(5000);
|
Loading…
Reference in New Issue