If retweets are disabled then check the summary for twitter posts

main
Bob Mottram 2022-07-26 19:21:26 +01:00
parent f4a7cc8a18
commit ab9d2ac24e
1 changed files with 23 additions and 0 deletions

View File

@ -567,6 +567,22 @@ def inbox_permitted_message(domain: str, message_json: {},
return True
def _reject_twitter_summary(base_dir: str, nickname: str, domain: str,
summary: str) -> bool:
"""Returns true if the post should be rejected due to twitter
existing within the summary
"""
remove_twitter = \
acct_dir(base_dir, nickname, domain) + '/.removeTwitter'
if not os.path.isfile(remove_twitter):
return False
summary_lower = summary.lower()
if 'twitter' in summary_lower or \
'birdsite' in summary_lower:
return True
return False
def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
nickname: str, domain: str,
post_json_object: {},
@ -655,6 +671,13 @@ def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
if debug:
print('WARN: post was filtered out due to content')
return None
if summary_str:
if _reject_twitter_summary(base_dir, nickname, domain,
summary_str):
if debug:
print('WARN: post was filtered out due to ' +
'twitter content')
return None
original_post_id = None
if post_json_object.get('id'):