From 57b96c6c33f4e58bccb3bcfcd2ce575c66d60f90 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Mar 2022 22:13:07 +0100 Subject: [PATCH] Don't show announce icon if emoji indicates no boost --- webapp_post.py | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index f215a2e5e..78873669f 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -565,7 +565,7 @@ def _get_announce_icon_html(is_announced: bool, timeline_post_bookmark: str, box_name: str, max_announce_count: int) -> str: - """Returns html for announce icon/button + """Returns html for announce icon/button at the bottom of the post """ announce_str = '' @@ -1922,17 +1922,6 @@ def individual_post_as_html(signing_priv_key_pem: str, container_class_icons = 'containericons dm' container_class = 'container dm' - new_footer_str = \ - _get_footer_with_icons(show_icons, - container_class_icons, - reply_str, announce_str, - like_str, reaction_str, bookmark_str, - delete_str, mute_str, edit_str, - post_json_object, published_link, - time_class, published_str) - if new_footer_str: - footer_str = new_footer_str - # add any content warning from the cwlists directory add_cw_from_lists(post_json_object, cw_lists, translate, lists_enabled) @@ -1951,11 +1940,6 @@ def individual_post_as_html(signing_priv_key_pem: str, system_language: sensitive_str } - # add an extra line if there is a content warning, - # for better vertical spacing on mobile - if post_is_sensitive: - footer_str = '
' + footer_str - if not post_json_object['object'].get('summary'): post_json_object['object']['summary'] = '' post_json_object['object']['summaryMap'] = { @@ -1986,6 +1970,33 @@ def individual_post_as_html(signing_priv_key_pem: str, if not content_str: return '' + # does an emoji indicate no boost preference? + # if so then don't show the repeat/announce icon + if content_str: + if ':boost_no:' in content_str or \ + ':noboost:' in content_str or \ + ':noboosts:' in content_str or \ + ':no_boost:' in content_str or \ + ':no_boosts:' in content_str or \ + ':boosts_no:' in content_str: + announce_str = '' + + new_footer_str = \ + _get_footer_with_icons(show_icons, + container_class_icons, + reply_str, announce_str, + like_str, reaction_str, bookmark_str, + delete_str, mute_str, edit_str, + post_json_object, published_link, + time_class, published_str) + if new_footer_str: + footer_str = new_footer_str + + # add an extra line if there is a content warning, + # for better vertical spacing on mobile + if post_is_sensitive: + footer_str = '
' + footer_str + summary_str = get_summary_from_post(post_json_object, system_language, languages_understood) is_patch = is_git_patch(base_dir, nickname, domain,