forked from MarseyWorld/MarseyWorld
limit polls to 10 options to prevent spam
parent
c5446b3a39
commit
e4b521a63f
|
@ -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 poll_regex.finditer(body):
|
||||
for i in list(poll_regex.finditer(body))[:10]:
|
||||
options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
choices = []
|
||||
for i in choice_regex.finditer(body):
|
||||
for i in list(choice_regex.finditer(body))[:10]:
|
||||
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 poll_regex.finditer(body):
|
||||
for i in list(poll_regex.finditer(body))[:10]:
|
||||
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 choice_regex.finditer(body):
|
||||
for i in list(choice_regex.finditer(body))[:10]:
|
||||
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!")
|
||||
|
|
|
@ -360,7 +360,7 @@ def edit_post(pid, v):
|
|||
)
|
||||
g.db.add(bet)
|
||||
|
||||
for i in poll_regex.finditer(body):
|
||||
for i in list(poll_regex.finditer(body))[:10]:
|
||||
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!")
|
||||
|
@ -371,7 +371,7 @@ def edit_post(pid, v):
|
|||
)
|
||||
g.db.add(option)
|
||||
|
||||
for i in choice_regex.finditer(body):
|
||||
for i in list(choice_regex.finditer(body))[:10]:
|
||||
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!")
|
||||
|
@ -754,12 +754,12 @@ def submit_post(v, sub=None):
|
|||
body = body.replace(i.group(0), "")
|
||||
|
||||
options = []
|
||||
for i in poll_regex.finditer(body):
|
||||
for i in list(poll_regex.finditer(body))[:10]:
|
||||
options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
choices = []
|
||||
for i in choice_regex.finditer(body):
|
||||
for i in list(choice_regex.finditer(body))[:10]:
|
||||
choices.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
|
|
Loading…
Reference in New Issue