forked from MarseyWorld/MarseyWorld
fix ping limiting being applies on all instances of "sanitize()"
parent
fe0d1beb6e
commit
981692550f
|
@ -214,7 +214,7 @@ def with_sigalrm_timeout(timeout: int):
|
|||
|
||||
|
||||
@with_sigalrm_timeout(2)
|
||||
def sanitize(sanitized, edit=False):
|
||||
def sanitize(sanitized, edit=False, limit_pings=False):
|
||||
sanitized = sanitized.strip()
|
||||
|
||||
sanitized = normalize_url(sanitized)
|
||||
|
@ -246,7 +246,7 @@ def sanitize(sanitized, edit=False):
|
|||
|
||||
matches = [ m for m in mention_regex.finditer(sanitized) if m ]
|
||||
names = set( m.group(2) for m in matches )
|
||||
if len(names) > 3 and not v.admin_level: abort(406)
|
||||
if limit_pings and len(names) > 3 and not v.admin_level: abort(406)
|
||||
users = get_users(names, graceful=True)
|
||||
|
||||
for u in users:
|
||||
|
|
|
@ -284,7 +284,7 @@ def api_comment(v):
|
|||
if v.agendaposter and not v.marseyawarded and parent_post.id not in ADMIGGERS:
|
||||
body = torture_ap(body, v.username)
|
||||
|
||||
body_html = sanitize(body)
|
||||
body_html = sanitize(body, limit_pings=True)
|
||||
|
||||
|
||||
if parent_post.id not in ADMIGGERS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
|
||||
|
@ -713,7 +713,7 @@ def edit_comment(cid, v):
|
|||
|
||||
body = body.strip()
|
||||
|
||||
body_html = sanitize(body, edit=True)
|
||||
body_html = sanitize(body, edit=True, limit_pings=True)
|
||||
|
||||
if len(body_html) > 20000: abort(400)
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ def edit_post(pid, v):
|
|||
g.db.add(option)
|
||||
|
||||
|
||||
body_html = sanitize(body, edit=True)
|
||||
body_html = sanitize(body, edit=True, limit_pings=True)
|
||||
|
||||
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||
return {"error":"You can only type marseys!"}, 403
|
||||
|
@ -875,7 +875,7 @@ def submit_post(v, sub=None):
|
|||
|
||||
body = body.strip()
|
||||
|
||||
body_html = sanitize(body)
|
||||
body_html = sanitize(body, limit_pings=True)
|
||||
|
||||
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||
return error("You can only type marseys!")
|
||||
|
|
Loading…
Reference in New Issue