diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index f8923a5c8..aee141d02 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -336,7 +336,6 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis= sanitized = utm_regex2.sub('', sanitized) if torture: - sanitized = torture_ap(sanitized, g.v.username) to_add = random.choice(chud_images) sanitized += f'\n\n{to_add}' @@ -548,9 +547,7 @@ def allowed_attributes_emojis(tag, name, value): @with_sigalrm_timeout(1) -def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, torture=False, strip=True): - if torture: - title = torture_ap(title, g.v.username) +def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, strip=True): title = title.replace('‎','').replace('​','').replace("\ufeff", "").replace("𒐪","").replace("\n", "").replace("\r", "").replace("\t", "").replace('<','<').replace('>','>').replace("﷽","") @@ -640,4 +637,9 @@ def complies_with_chud(obj): if obj.author.agendaposter_phrase in text: return True + if isinstance(obj, Submission): + obj.title_html = torture_ap(title_html, obj.author.username) + + obj.body_html = torture_ap(body_html, obj.author.username) + return False diff --git a/files/routes/posts.py b/files/routes/posts.py index deb0ac667..67c2d4b3d 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -445,8 +445,8 @@ def submit_post(v:User, sub=None): sub = request.values.get("sub", "").lower().replace('/h/','').strip() - torture = (v.agendaposter and not v.marseyawarded and sub != 'chudrama') - title_html = filter_emojis_only(title, graceful=True, count_emojis=True, torture=torture) + title_html = filter_emojis_only(title, graceful=True, count_emojis=True) + if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html): abort(400, "You can only type marseys!") if len(title_html) > POST_TITLE_HTML_LENGTH_LIMIT: @@ -1002,9 +1002,7 @@ def edit_post(pid, v): if title != p.title: - torture = (v.agendaposter and not v.marseyawarded and p.sub != 'chudrama' and v.id == p.author_id) - - title_html = filter_emojis_only(title, golden=False, torture=torture) + title_html = filter_emojis_only(title, golden=False) if v.id == p.author_id and v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html): abort(403, "You can only type marseys!")