fix 2 chud phrases

master
Aevann 2023-03-23 17:36:28 +02:00
parent 333f536f1a
commit f5e507f795
2 changed files with 9 additions and 9 deletions

View File

@ -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('<','&lt;').replace('>','&gt;').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

View File

@ -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!")