Use appropriate post id for conversation items

main
Bob Mottram 2024-05-29 14:11:05 +01:00
parent a96b352653
commit c19b896ed7
1 changed files with 13 additions and 6 deletions

View File

@ -240,33 +240,40 @@ def download_conversation_posts(authorized: bool, session,
if not isinstance(post_json_object, dict): if not isinstance(post_json_object, dict):
break break
if not has_object_dict(post_json_object): if not has_object_dict(post_json_object):
if not post_json_object.get('id'):
break
if not isinstance(post_json_object['id'], str):
break
if not post_json_object.get('attributedTo'): if not post_json_object.get('attributedTo'):
print(str(post_json_object))
if debug: if debug:
print(post_id + ' has no attributedTo') print(str(post_json_object))
print(post_json_object['id'] + ' has no attributedTo')
break break
attrib_str = get_attributed_to(post_json_object['attributedTo']) attrib_str = get_attributed_to(post_json_object['attributedTo'])
if not attrib_str: if not attrib_str:
break break
if not post_json_object.get('published'): if not post_json_object.get('published'):
if debug: if debug:
print(post_id + ' has no published date') print(str(post_json_object))
print(post_json_object['id'] + ' has no published date')
break break
if not post_json_object.get('to'): if not post_json_object.get('to'):
if debug: if debug:
print(post_id + ' has no "to" list') print(str(post_json_object))
print(post_json_object['id'] + ' has no "to" list')
break break
if not isinstance(post_json_object['to'], list): if not isinstance(post_json_object['to'], list):
break break
if 'cc' not in post_json_object: if 'cc' not in post_json_object:
if debug: if debug:
print(post_id + ' has no "cc" list') print(str(post_json_object))
print(post_json_object['id'] + ' has no "cc" list')
break break
if not isinstance(post_json_object['cc'], list): if not isinstance(post_json_object['cc'], list):
break break
wrapped_post = { wrapped_post = {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
'id': post_id + '/activity', 'id': post_json_object['id'] + '/activity',
'type': 'Create', 'type': 'Create',
'actor': attrib_str, 'actor': attrib_str,
'published': post_json_object['published'], 'published': post_json_object['published'],