From e0176c6a81ccebf33bdc7d47db358c40852a004b Mon Sep 17 00:00:00 2001 From: bashrc Date: Fri, 29 May 2026 19:31:54 +0100 Subject: [PATCH] When checking CW domains also check the domain of the original post author --- cwlists.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cwlists.py b/cwlists.py index 8fcf5ec12..c716668ce 100644 --- a/cwlists.py +++ b/cwlists.py @@ -12,6 +12,8 @@ from utils import load_json from utils import get_content_from_post from utils import content_is_single_url from utils import is_yggdrasil_address +from utils import get_attributed_to +from utils import has_object_dict from data import is_a_dir @@ -169,10 +171,23 @@ def add_cw_from_lists(post_json_object: {}, cw_lists: {}, translate: {}, if matched: continue - # match domains within the content + # match domains within the content and the original post author if item.get('domains'): + # when checking domains also check the domain of the post author. + # A typical scenario might be someone you follow boosting a post + # from a disinformation instance + attrib_str: str = '' + this_post_json: dict = post_json_object + if has_object_dict(post_json_object): + this_post_json = post_json_object['object'] + if this_post_json.get('attributedTo'): + attrib: str = get_attributed_to(this_post_json['attributedTo']) + if attrib: + attrib_str = ' ' + attrib + matched, cw_text = \ - _add_cw_match_domains(item, content, cw_text, warning) + _add_cw_match_domains(item, content + attrib_str, cw_text, + warning) if matched: continue