diff --git a/utils.py b/utils.py index f18d70389..4a62fb6db 100644 --- a/utils.py +++ b/utils.py @@ -538,8 +538,14 @@ def get_summary_from_post(post_json_object: {}, system_language: str, """Returns the summary from the post in the given language including searching for a matching entry within summaryMap """ - return get_content_from_post(post_json_object, system_language, - languages_understood, "summary") + summary_str = \ + get_content_from_post(post_json_object, system_language, + languages_understood, "summary") + if summary_str: + summary_str = summary_str.strip() + if len(summary_str) < 2: + summary_str = '' + return summary_str def get_base_content_from_post(post_json_object: {}, diff --git a/webapp_post.py b/webapp_post.py index 60c3706ef..da9758764 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -2713,9 +2713,10 @@ def individual_post_as_html(signing_priv_key_pem: str, post_is_sensitive = False if post_json_object['object'].get('sensitive'): - # sensitive posts should have a summary - if post_json_object['object'].get('summary'): - post_is_sensitive = post_json_object['object']['sensitive'] + if isinstance(post_json_object['object']['sensitive'], bool): + # sensitive posts should have a summary + if post_json_object['object'].get('summary'): + post_is_sensitive = post_json_object['object']['sensitive'] if not post_json_object['object'].get('summary'): post_json_object['object']['summary'] = '' @@ -2885,6 +2886,7 @@ def individual_post_as_html(signing_priv_key_pem: str, post_id = 'post' + str(create_password(8)) content_str = '' if summary_str: + # set the content warning cw_str = \ add_emoji_to_display_name(session, base_dir, http_prefix, nickname, domain,