diff --git a/files/helpers/const.py b/files/helpers/const.py index 43cc3c0a1..134f2b7ea 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -436,6 +436,7 @@ MODMAIL_ID = 2 POLL_THREAD = 0 POLL_BET_COINS = 200 +POLL_MAX_OPTIONS = 10 WELCOME_MSG = f"Welcome to {SITE_NAME}!" LOTTERY_TICKET_COST = 12 diff --git a/files/routes/comments.py b/files/routes/comments.py index 7c71fc6b6..e6766f93b 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -132,12 +132,12 @@ def comment(v): abort(403, "You can't reply to users who have blocked you or users that you have blocked.") options = [] - for i in list(poll_regex.finditer(body))[:10]: + for i in list(poll_regex.finditer(body))[:POLL_MAX_OPTIONS]: options.append(i.group(1)) body = body.replace(i.group(0), "") choices = [] - for i in list(choice_regex.finditer(body))[:10]: + for i in list(choice_regex.finditer(body))[:POLL_MAX_OPTIONS]: choices.append(i.group(1)) body = body.replace(i.group(0), "") @@ -390,7 +390,7 @@ def edit_comment(cid, v): elif v.bird and len(body) > 140: abort(403, "You have to type less than 140 characters!") - for i in list(poll_regex.finditer(body))[:10]: + for i in list(poll_regex.finditer(body))[:POLL_MAX_OPTIONS]: body = body.replace(i.group(0), "") body_html = filter_emojis_only(i.group(1)) if len(body_html) > 500: abort(400, "Poll option too long!") @@ -401,7 +401,7 @@ def edit_comment(cid, v): ) g.db.add(option) - for i in list(choice_regex.finditer(body))[:10]: + for i in list(choice_regex.finditer(body))[:POLL_MAX_OPTIONS]: body = body.replace(i.group(0), "") body_html = filter_emojis_only(i.group(1)) if len(body_html) > 500: abort(400, "Poll option too long!")