limit the "show more" button to comments only

pull/152/head
Aevann 2023-06-08 04:36:41 +03:00
parent 749f0b7f0a
commit 9c6c264307
6 changed files with 9 additions and 9 deletions

View File

@ -337,7 +337,7 @@ def handle_youtube_links(url):
return html
@with_sigalrm_timeout(10)
def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis=False, snappy=False, chat=False, blackjack=None):
def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis=False, snappy=False, chat=False, blackjack=None):
sanitized = sanitized.strip()
if not sanitized: return ''

View File

@ -84,7 +84,7 @@ def edit_rules_get(v):
@admin_level_required(PERMS['EDIT_RULES'])
def edit_rules_post(v):
rules = request.values.get('rules', '').strip()
rules = sanitize(rules, blackjack="rules", showmore=False)
rules = sanitize(rules, blackjack="rules")
with open(f'files/templates/rules_{SITE_NAME}.html', 'w+', encoding="utf-8") as f:
f.write(rules)

View File

@ -439,7 +439,7 @@ def award_thing(v, thing_type, id):
body = thing.body
if author.owoify: body = owoify(body)
body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5)
thing.body_html = sanitize(body, limit_pings=5, showmore=True)
g.db.add(thing)
elif "Vampire" in kind and kind == v.house:
if author.bite: author.bite += 172800
@ -465,7 +465,7 @@ def award_thing(v, thing_type, id):
body = thing.body
body = owoify(body)
if author.marsify: body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5)
thing.body_html = sanitize(body, limit_pings=5, showmore=True)
g.db.add(thing)
elif ("Femboy" in kind and kind == v.house) or kind == 'rainbow':
if author.rainbow: author.rainbow += 86400

View File

@ -240,7 +240,7 @@ def comment(v:User):
if v.owoify: body_for_sanitize = owoify(body_for_sanitize)
if v.marsify: body_for_sanitize = marsify(body_for_sanitize)
body_html = sanitize(body_for_sanitize, limit_pings=5, count_emojis=not v.marsify)
body_html = sanitize(body_for_sanitize, limit_pings=5, showmore=True, count_emojis=not v.marsify)
if post_target.id not in ADMIGGER_THREADS and not (v.agendaposter and v.agendaposter_phrase in body.lower()):
existing = g.db.query(Comment.id).filter(
@ -629,7 +629,7 @@ def edit_comment(cid, v):
if v.marsify:
body_for_sanitize = marsify(body_for_sanitize)
body_html = sanitize(body_for_sanitize, golden=False, limit_pings=5)
body_html = sanitize(body_for_sanitize, golden=False, limit_pings=5, showmore=True)
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: abort(400)

View File

@ -574,7 +574,7 @@ def submit_post(v:User, sub=None):
body = process_files(request.files, v, body)
body = body.strip()[:POST_BODY_LENGTH_LIMIT(v)] # process_files() adds content to the body, so we need to re-strip
body_html = sanitize(body, count_emojis=True, limit_pings=100, showmore=False)
body_html = sanitize(body, count_emojis=True, limit_pings=100)
if v.marseyawarded and marseyaward_body_regex.search(body_html):
abort(400, "You can only type marseys!")
@ -1040,7 +1040,7 @@ def edit_post(pid, v):
body = body.strip()[:POST_BODY_LENGTH_LIMIT(v)] # process_files() may be adding stuff to the body
if body != p.body:
body_html = sanitize(body, golden=False, limit_pings=100, showmore=False)
body_html = sanitize(body, golden=False, limit_pings=100)
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!")

View File

@ -455,7 +455,7 @@ def post_sub_sidebar(v:User, sub):
if v.shadowbanned: return redirect(f'/h/{sub}/settings')
sub.sidebar = request.values.get('sidebar', '').strip()[:10000]
sub.sidebar_html = sanitize(sub.sidebar, blackjack=f"/h/{sub} sidebar", showmore=False)
sub.sidebar_html = sanitize(sub.sidebar, blackjack=f"/h/{sub} sidebar")
if len(sub.sidebar_html) > 20000: abort(400, "Sidebar is too big!")
g.db.add(sub)