From 7eee4980709a03b1f4ebe137ddd4cdbe7f977a7c Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 23 Mar 2023 21:03:02 +0200 Subject: [PATCH] fix bug where including the agendaposter phrase in the title exempted u from torture_ap --- files/helpers/sanitize.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 5a75d1ae8..e897361cb 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -618,19 +618,21 @@ def complies_with_chud(obj): if not obj.author.agendaposter: return True if obj.author.marseyawarded: return True + old_body_html = obj.body_html.lower() + if isinstance(obj, Submission): if obj.id in ADMIGGER_THREADS: return True if obj.sub == "chudrama": return True - if obj.author.agendaposter_phrase in obj.title: return True elif obj.parent_submission: if obj.parent_submission in ADMIGGER_THREADS: return True if obj.post.sub == "chudrama": return True - soup=BeautifulSoup(obj.body_html.lower(), 'lxml') - + obj.body_html = torture_ap(obj.body_html, obj.author.username) if isinstance(obj, Submission): obj.title_html = torture_ap(obj.title_html, obj.author.username) - obj.body_html = torture_ap(obj.body_html, obj.author.username) + if obj.author.agendaposter_phrase in obj.title: return True + + soup=BeautifulSoup(old_body_html, 'lxml') tags = soup.html.body.find_all(lambda tag: tag.name == 'p' and not tag.attrs, recursive=False)