Less indentation

merge-requests/30/head
Bob Mottram 2022-05-31 16:18:23 +01:00
parent e69beba537
commit 6f58f1d19e
1 changed files with 11 additions and 10 deletions

View File

@ -1072,6 +1072,7 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str,
"""If this is a reply and the original post has a CW
then use the same CW
"""
reply_to_json = None
if in_reply_to and not sensitive:
# locate the post which this is a reply to and check if
# it has a content warning. If it does then reproduce
@ -1080,16 +1081,16 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str,
locate_post(base_dir, nickname, domain, in_reply_to)
if reply_post_filename:
reply_to_json = load_json(reply_post_filename)
if reply_to_json:
if reply_to_json.get('object'):
if reply_to_json['object'].get('sensitive'):
if reply_to_json['object']['sensitive']:
sensitive = True
if reply_to_json['object'].get('summary'):
summary = \
get_summary_from_post(reply_to_json,
system_language,
languages_understood)
if reply_to_json:
if reply_to_json.get('object'):
if reply_to_json['object'].get('sensitive'):
if reply_to_json['object']['sensitive']:
sensitive = True
if reply_to_json['object'].get('summary'):
summary = \
get_summary_from_post(reply_to_json,
system_language,
languages_understood)
return sensitive, summary