forked from rDrama/rDrama
change ping_limit to be 3 for comments, and 50 for posts
parent
ce80f8e30e
commit
fb2437574f
|
@ -214,7 +214,7 @@ def with_sigalrm_timeout(timeout: int):
|
|||
|
||||
|
||||
@with_sigalrm_timeout(2)
|
||||
def sanitize(sanitized, edit=False, limit_pings=False, showmore=True):
|
||||
def sanitize(sanitized, edit=False, limit_pings=0, showmore=True):
|
||||
sanitized = sanitized.strip()
|
||||
|
||||
sanitized = normalize_url(sanitized)
|
||||
|
@ -246,7 +246,7 @@ def sanitize(sanitized, edit=False, limit_pings=False, showmore=True):
|
|||
|
||||
matches = [m for m in mention_regex.finditer(sanitized) if m]
|
||||
names = set(m.group(2) for m in matches)
|
||||
if limit_pings and len(names) > 3 and not v.admin_level: abort(406)
|
||||
if limit_pings and len(names) > limit_pings and not v.admin_level: abort(406)
|
||||
users = get_users(names, graceful=True)
|
||||
|
||||
for u in users:
|
||||
|
|
|
@ -285,7 +285,7 @@ def comment(v):
|
|||
if v.agendaposter and not v.marseyawarded and parent_post.id not in ADMIGGERS and parent_post.sub != 'chudrama':
|
||||
body = torture_ap(body, v.username)
|
||||
|
||||
body_html = sanitize(body, limit_pings=True)
|
||||
body_html = sanitize(body, limit_pings=3)
|
||||
|
||||
|
||||
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() and parent_post.sub != 'chudrama':
|
||||
|
@ -715,7 +715,7 @@ def edit_comment(cid, v):
|
|||
|
||||
body = body.strip()
|
||||
|
||||
body_html = sanitize(body, edit=True, limit_pings=True)
|
||||
body_html = sanitize(body, edit=True, limit_pings=3)
|
||||
|
||||
if len(body_html) > 20000: abort(400)
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ def error_401(e):
|
|||
|
||||
@app.errorhandler(406)
|
||||
def error_406(e):
|
||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "You can't ping more than 3 people!"}, 406
|
||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "Too many pings: max limit is 3 for comments and 50 for posts"}, 406
|
||||
else: return render_template('errors/406.html', err=True), 406
|
||||
|
||||
@app.errorhandler(403)
|
||||
|
|
|
@ -446,7 +446,7 @@ def edit_post(pid, v):
|
|||
g.db.add(option)
|
||||
|
||||
|
||||
body_html = sanitize(body, edit=True, limit_pings=True, showmore=False)
|
||||
body_html = sanitize(body, edit=True, limit_pings=100, showmore=False)
|
||||
|
||||
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||
return {"error":"You can only type marseys!"}, 403
|
||||
|
@ -899,7 +899,7 @@ def submit_post(v, sub=None):
|
|||
|
||||
body = body.strip()
|
||||
|
||||
body_html = sanitize(body, limit_pings=True, showmore=False)
|
||||
body_html = sanitize(body, limit_pings=100, showmore=False)
|
||||
|
||||
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||
return error("You can only type marseys!")
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<img alt=":#marseyrage" loading="lazy" src="/e/marseyrage.webp">
|
||||
<pre></pre>
|
||||
<h1 class="h5">Too many pings</h1>
|
||||
<p class="text-muted mb-5">You can't ping more than 3 people!</p>
|
||||
<p class="text-muted mb-5">Max limit is 3 for comments and 50 for posts</p>
|
||||
<div><a href="/" class="btn btn-primary">Go to frontpage</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue