diff --git a/blocking.py b/blocking.py index 3f40d1884..39dbd3976 100644 --- a/blocking.py +++ b/blocking.py @@ -910,6 +910,9 @@ def mute_post(base_dir: str, nickname: str, domain: str, port: int, if post_json_obj.get('conversation'): mute_conversation(base_dir, nickname, domain, post_json_obj['conversation']) + elif post_json_obj.get('context'): + mute_conversation(base_dir, nickname, domain, + post_json_obj['context']) # does this post have ignores on it from differenent actors? if not post_json_obj.get('ignores'): @@ -1048,6 +1051,9 @@ def unmute_post(base_dir: str, nickname: str, domain: str, port: int, if post_json_obj.get('conversation'): unmute_conversation(base_dir, nickname, domain, post_json_obj['conversation']) + elif post_json_obj.get('context'): + unmute_conversation(base_dir, nickname, domain, + post_json_obj['context']) if post_json_obj.get('ignores'): domain_full = get_full_domain(domain, port) diff --git a/conversation.py b/conversation.py index 689ac7269..9945eb22d 100644 --- a/conversation.py +++ b/conversation.py @@ -25,14 +25,18 @@ def _get_conversation_filename(base_dir: str, nickname: str, domain: str, """ if not has_object_dict(post_json_object): return None - if not post_json_object['object'].get('conversation'): + if not post_json_object['object'].get('conversation') and \ + not post_json_object['object'].get('context'): return None if not post_json_object['object'].get('id'): return None conversation_dir = acct_dir(base_dir, nickname, domain) + '/conversation' if not os.path.isdir(conversation_dir): os.mkdir(conversation_dir) - conversation_id = post_json_object['object']['conversation'] + if post_json_object['object'].get('conversation'): + conversation_id = post_json_object['object']['conversation'] + else: + conversation_id = post_json_object['object']['context'] conversation_id = conversation_id.replace('/', '#') return conversation_dir + '/' + conversation_id diff --git a/desktop_client.py b/desktop_client.py index a2d4cad96..e7d4f6de6 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -1825,6 +1825,9 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, if post_json_object['object'].get('conversation'): conversation_id = \ post_json_object['object']['conversation'] + elif post_json_object['object'].get('context'): + conversation_id = \ + post_json_object['object']['context'] session_reply = create_session(proxy_type) _desktop_reply_to_post(session_reply, post_id, base_dir, nickname, diff --git a/happening.py b/happening.py index 1d479cfe9..7d14f323d 100644 --- a/happening.py +++ b/happening.py @@ -911,6 +911,7 @@ def _dav_store_event(base_dir: str, nickname: str, domain: str, "object": { "id": post_id, "conversation": post_id, + "context": post_id, "type": "Note", "summary": None, "inReplyTo": None, diff --git a/inbox.py b/inbox.py index fff698f05..0986f627e 100644 --- a/inbox.py +++ b/inbox.py @@ -3993,6 +3993,8 @@ def _create_reply_notification_file(base_dir: str, nickname: str, domain: str, conversation_id = None if post_json_object['object'].get('conversation'): conversation_id = post_json_object['object']['conversation'] + elif post_json_object['object'].get('context'): + conversation_id = post_json_object['object']['context'] if not post_json_object['object'].get('inReplyTo'): return is_reply_to_muted_post diff --git a/posts.py b/posts.py index f1b0b13f6..21a8c0574 100644 --- a/posts.py +++ b/posts.py @@ -1126,6 +1126,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int, 'object': { 'id': new_post_id, 'conversation': conversation_id, + 'context': conversation_id, 'type': post_object_type, 'summary': summary, 'inReplyTo': in_reply_to, @@ -1193,6 +1194,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int, "@context": post_context, 'id': new_post_id, 'conversation': conversation_id, + 'context': conversation_id, 'type': post_object_type, 'summary': summary, 'inReplyTo': in_reply_to, diff --git a/utils.py b/utils.py index a91995a71..80fb52d7b 100644 --- a/utils.py +++ b/utils.py @@ -2032,13 +2032,17 @@ def _delete_conversation_post(base_dir: str, nickname: str, domain: str, """ if not has_object_dict(post_json_object): return False - if not post_json_object['object'].get('conversation'): + if not post_json_object['object'].get('conversation') and \ + not post_json_object['object'].get('context'): return False if not post_json_object['object'].get('id'): return False conversation_dir = \ acct_dir(base_dir, nickname, domain) + '/conversation' - conversation_id = post_json_object['object']['conversation'] + if post_json_object['object'].get('conversation'): + conversation_id = post_json_object['object']['conversation'] + else: + conversation_id = post_json_object['object']['context'] conversation_id = conversation_id.replace('/', '#') post_id = post_json_object['object']['id'] conversation_filename = conversation_dir + '/' + conversation_id diff --git a/video.py b/video.py index 3a67e1de1..8e764ad76 100644 --- a/video.py +++ b/video.py @@ -150,6 +150,7 @@ def convert_video_to_note(base_dir: str, nickname: str, domain: str, 'object': { 'id': new_post_id, 'conversation': conversation_id, + 'context': conversation_id, 'type': 'Note', 'summary': None, 'inReplyTo': None, diff --git a/webapp_create_post.py b/webapp_create_post.py index 9df6413ca..8155b6c96 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -258,6 +258,8 @@ def html_new_post(edit_post_params: {}, return '' if edited_post_json['object'].get('conversation'): conversation_id = edited_post_json['object']['conversation'] + elif edited_post_json['object'].get('context'): + conversation_id = edited_post_json['object']['context'] if edit_post_params.get('replyTo'): in_reply_to = edit_post_params['replyTo'] if edit_post_params['scope'] == 'dm': diff --git a/webapp_post.py b/webapp_post.py index fc6da176d..31c8ac4da 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -2177,10 +2177,13 @@ def individual_post_as_html(signing_priv_key_pem: str, comments_enabled = False conversation_id = None - if isinstance(post_json_object['object'], dict) and \ - 'conversation' in post_json_object['object']: - if post_json_object['object']['conversation']: - conversation_id = post_json_object['object']['conversation'] + if isinstance(post_json_object['object'], dict): + if 'conversation' in post_json_object['object']: + if post_json_object['object']['conversation']: + conversation_id = post_json_object['object']['conversation'] + elif 'context' in post_json_object['object']: + if post_json_object['object']['context']: + conversation_id = post_json_object['object']['context'] public_reply = False unlisted_reply = False