Adding reactionsOf

main
Bob Mottram 2025-03-31 12:07:00 +01:00
parent b0a3a86510
commit 5b1f8c064a
2 changed files with 11 additions and 3 deletions

View File

@ -1048,6 +1048,7 @@ def _dav_store_event(base_dir: str, nickname: str, domain: str,
], ],
'replies': { 'replies': {
'id': post_id + '/replies', 'id': post_id + '/replies',
'repliesOf': post_id,
'type': 'Collection', 'type': 'Collection',
'first': { 'first': {
'type': 'CollectionPage', 'type': 'CollectionPage',

View File

@ -559,8 +559,14 @@ def update_reaction_collection(recent_posts_cache: {},
if has_object_dict(post_json_object): if has_object_dict(post_json_object):
obj = post_json_object['object'] obj = post_json_object['object']
if not object_url.endswith('/reactions'): reactions_ending = '/reactions'
object_url = object_url + '/reactions' if not object_url.endswith(reactions_ending):
collection_id = object_url + reactions_ending
else:
collection_id = object_url
reactions_ending_len = len(object_url) - len(reactions_ending)
object_url = object_url[:reactions_ending_len]
if not obj.get('reactions'): if not obj.get('reactions'):
if debug: if debug:
print('DEBUG: Adding initial emoji reaction to ' + object_url) print('DEBUG: Adding initial emoji reaction to ' + object_url)
@ -569,7 +575,8 @@ def update_reaction_collection(recent_posts_cache: {},
'https://www.w3.org/ns/activitystreams', 'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1' 'https://w3id.org/security/v1'
], ],
'id': object_url, 'id': collection_id,
'reactionsOf': object_url,
'type': 'Collection', 'type': 'Collection',
"totalItems": 1, "totalItems": 1,
'items': [{ 'items': [{