diff --git a/inbox.py b/inbox.py index 6f2ba0b06..68e821ea6 100644 --- a/inbox.py +++ b/inbox.py @@ -2693,7 +2693,7 @@ def _receive_announce(recent_posts_cache: {}, announced_actor_nickname + '@' + announced_actor_domain) return False - # is this post in the outbox of the person? + # is this post in the inbox or outbox of the account? post_filename = locate_post(base_dir, nickname, domain, message_json['object']) if not post_filename: @@ -2701,6 +2701,7 @@ def _receive_announce(recent_posts_cache: {}, print('DEBUG: announce post not found in inbox or outbox') print(message_json['object']) return True + # add actor to the list of announcers for a post update_announce_collection(recent_posts_cache, base_dir, post_filename, message_json['actor'], nickname, domain, debug) if debug: diff --git a/webapp_post.py b/webapp_post.py index 6f332ca61..a589e78e6 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -362,7 +362,7 @@ def _save_individual_post_as_html_to_cache(base_dir: str, with open(cached_post_filename, 'w+', encoding='utf-8') as fp_cache: fp_cache.write(post_html) return True - except Exception as ex: + except OSError as ex: print('ERROR: saving post to cache, ' + str(ex)) return False @@ -916,7 +916,9 @@ def _get_like_icon_html(nickname: str, domain_full: str, return like_str -def _get_bookmark_icon_html(nickname: str, domain_full: str, +def _get_bookmark_icon_html(base_dir: str, + nickname: str, domain: str, + domain_full: str, post_json_object: {}, is_moderation_post: bool, translate: {}, @@ -924,7 +926,8 @@ def _get_bookmark_icon_html(nickname: str, domain_full: str, post_start_time, box_name: str, page_number_param: str, timeline_post_bookmark: str, - first_post_id: str) -> str: + first_post_id: str, + post_url: str) -> str: """Returns html for bookmark icon/button """ bookmark_str = '' @@ -932,6 +935,9 @@ def _get_bookmark_icon_html(nickname: str, domain_full: str, if is_moderation_post: return bookmark_str + if not locate_post(base_dir, nickname, domain, post_url): + return bookmark_str + bookmark_icon = 'bookmark_inactive.png' bookmark_link = 'bookmark' bookmark_emoji = '' @@ -2133,9 +2139,13 @@ def individual_post_as_html(signing_priv_key_pem: str, translate, post_json_object['actor'], theme_name, system_language, box_name) - with open(announce_filename + '.tts', 'w+', - encoding='utf-8') as ttsfile: - ttsfile.write('\n') + try: + with open(announce_filename + '.tts', 'w+', + encoding='utf-8') as ttsfile: + ttsfile.write('\n') + except OSError: + print('EX: unable to write tts ' + + announce_filename + '.tts') is_announced = True @@ -2295,15 +2305,14 @@ def individual_post_as_html(signing_priv_key_pem: str, _log_post_timing(enable_timing_log, post_start_time, '12.5') bookmark_str = \ - _get_bookmark_icon_html(nickname, domain_full, - post_json_object, - is_moderation_post, - translate, + _get_bookmark_icon_html(base_dir, nickname, domain, + domain_full, post_json_object, + is_moderation_post, translate, enable_timing_log, post_start_time, box_name, page_number_param, timeline_post_bookmark, - first_post_id) + first_post_id, message_id) _log_post_timing(enable_timing_log, post_start_time, '12.9') @@ -2652,8 +2661,10 @@ def individual_post_as_html(signing_priv_key_pem: str, translate) if map_str: map_str = '
@' + search_nickname + '@' + search_domain_full + \
'
\n'
@@ -692,15 +701,17 @@ def html_profile(signing_priv_key_pem: str,
domain, port = get_domain_from_actor(profile_json['id'])
if not domain:
return ""
+ display_name = remove_html(profile_json['name'])
display_name = \
add_emoji_to_display_name(session, base_dir, http_prefix,
nickname, domain,
- profile_json['name'], True, translate)
+ display_name, True, translate)
domain_full = get_full_domain(domain, port)
+ profile_description = profile_json['summary']
profile_description = \
add_emoji_to_display_name(session, base_dir, http_prefix,
nickname, domain,
- profile_json['summary'], False, translate)
+ profile_description, False, translate)
if profile_description:
profile_description = standardize_text(profile_description)
posts_button = 'button'