bookmarksOf on bookmarks collection

main
Bob Mottram 2025-03-31 12:38:04 +01:00
parent 919fde0137
commit bd1fd2c71d
1 changed files with 11 additions and 3 deletions

View File

@ -198,8 +198,15 @@ def update_bookmarks_collection(recent_posts_cache: {},
print('DEBUG: no object in bookmarked post ' + print('DEBUG: no object in bookmarked post ' +
str(post_json_object)) str(post_json_object))
return return
if not object_url.endswith('/bookmarks'):
object_url = object_url + '/bookmarks' bookmarks_ending = '/bookmarks'
if not object_url.endswith(bookmarks_ending):
collection_id = object_url + bookmarks_ending
else:
collection_id = object_url
object_url_len = len(object_url) - len(bookmarks_ending)
object_url = object_url[:object_url_len]
# does this post have bookmarks on it from differenent actors? # does this post have bookmarks on it from differenent actors?
if not post_json_object['object'].get('bookmarks'): if not post_json_object['object'].get('bookmarks'):
if debug: if debug:
@ -209,7 +216,8 @@ def update_bookmarks_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,
'bookmarksOf': object_url,
'type': 'Collection', 'type': 'Collection',
"totalItems": 1, "totalItems": 1,
'items': [{ 'items': [{