Disable showmore logic on posts.
parent
f2030077f0
commit
55c1ad859e
|
@ -214,7 +214,7 @@ def with_sigalrm_timeout(timeout: int):
|
||||||
|
|
||||||
|
|
||||||
@with_sigalrm_timeout(2)
|
@with_sigalrm_timeout(2)
|
||||||
def sanitize(sanitized, edit=False, limit_pings=False):
|
def sanitize(sanitized, edit=False, limit_pings=False, showmore=True):
|
||||||
sanitized = sanitized.strip()
|
sanitized = sanitized.strip()
|
||||||
|
|
||||||
sanitized = normalize_url(sanitized)
|
sanitized = normalize_url(sanitized)
|
||||||
|
@ -388,7 +388,7 @@ def sanitize(sanitized, edit=False, limit_pings=False):
|
||||||
if '<pre>' not in sanitized:
|
if '<pre>' not in sanitized:
|
||||||
sanitized = sanitized.replace('\n','')
|
sanitized = sanitized.replace('\n','')
|
||||||
|
|
||||||
if len(sanitized) > 5000:
|
if showmore and len(sanitized) > 5000:
|
||||||
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" onclick="showmore()">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized)
|
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" onclick="showmore()">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized)
|
||||||
|
|
||||||
return sanitized.strip()
|
return sanitized.strip()
|
||||||
|
|
|
@ -439,7 +439,7 @@ def edit_post(pid, v):
|
||||||
g.db.add(option)
|
g.db.add(option)
|
||||||
|
|
||||||
|
|
||||||
body_html = sanitize(body, edit=True, limit_pings=True)
|
body_html = sanitize(body, edit=True, limit_pings=True, showmore=False)
|
||||||
|
|
||||||
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||||
return {"error":"You can only type marseys!"}, 403
|
return {"error":"You can only type marseys!"}, 403
|
||||||
|
@ -890,7 +890,7 @@ def submit_post(v, sub=None):
|
||||||
|
|
||||||
body = body.strip()
|
body = body.strip()
|
||||||
|
|
||||||
body_html = sanitize(body, limit_pings=True)
|
body_html = sanitize(body, limit_pings=True, showmore=False)
|
||||||
|
|
||||||
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||||
return error("You can only type marseys!")
|
return error("You can only type marseys!")
|
||||||
|
|
Loading…
Reference in New Issue