Don't show announce icon if emoji indicates no boost

main
Bob Mottram 2022-03-28 22:13:07 +01:00
parent 692acccd7f
commit 57b96c6c33
1 changed files with 28 additions and 17 deletions

View File

@ -565,7 +565,7 @@ def _get_announce_icon_html(is_announced: bool,
timeline_post_bookmark: str, timeline_post_bookmark: str,
box_name: str, box_name: str,
max_announce_count: int) -> 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 = '' announce_str = ''
@ -1922,17 +1922,6 @@ def individual_post_as_html(signing_priv_key_pem: str,
container_class_icons = 'containericons dm' container_class_icons = 'containericons dm'
container_class = 'container 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 any content warning from the cwlists directory
add_cw_from_lists(post_json_object, cw_lists, translate, lists_enabled) 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 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 = '<br>' + footer_str
if not post_json_object['object'].get('summary'): if not post_json_object['object'].get('summary'):
post_json_object['object']['summary'] = '' post_json_object['object']['summary'] = ''
post_json_object['object']['summaryMap'] = { post_json_object['object']['summaryMap'] = {
@ -1986,6 +1970,33 @@ def individual_post_as_html(signing_priv_key_pem: str,
if not content_str: if not content_str:
return '' 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 = '<br>' + footer_str
summary_str = get_summary_from_post(post_json_object, system_language, summary_str = get_summary_from_post(post_json_object, system_language,
languages_understood) languages_understood)
is_patch = is_git_patch(base_dir, nickname, domain, is_patch = is_git_patch(base_dir, nickname, domain,