polls: constantify max poll options

pull/24/head
justcool393 2022-11-25 16:12:25 -06:00 committed by geese_suck
parent 7e8674db6e
commit e5f54243ea
Signed by: geese_suck
GPG Key ID: 4D09E4B0A7264746
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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!")