From de5191a10eeec99a4ea22931ab3a7b4db36cd6e9 Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Wed, 2 Aug 2023 19:12:09 -0700 Subject: [PATCH] bug fix for web user updat profile button for synthesized update/create/delete activities, switch actor id from protocol-specific AP to protocol-agnostic web URL. thanks @capjamesg for reporting! --- pages.py | 3 ++- web.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pages.py b/pages.py index 86b4eea..959e0bd 100644 --- a/pages.py +++ b/pages.py @@ -245,7 +245,8 @@ def fetch_objects(query): id = common.redirect_unwrap(inner_obj.get('id', '')) url = urls[0] if urls else id if (type == 'update' and - (obj.users and id.strip('/') == obj.users[0].id() + (obj.users and (g.user.is_web_url(id) + or id.strip('/') == obj.users[0].id()) or obj.domains and id.strip('/') == f'https://{obj.domains[0]}')): obj.phrase = 'updated' obj_as1.update({ diff --git a/web.py b/web.py index 2729f3c..05cf6b0 100644 --- a/web.py +++ b/web.py @@ -543,7 +543,7 @@ def webmention_task(): 'id': id, 'objectType': 'activity', 'verb': 'delete', - 'actor': g.user.ap_actor(), + 'actor': g.user.web_url(), 'object': source, }) @@ -553,7 +553,7 @@ def webmention_task(): authors = obj.mf2['properties'].setdefault('author', []) author_urls = microformats2.get_string_urls(authors) if not author_urls: - authors.append(g.user.ap_actor()) + authors.append(g.user.web_url()) elif not g.user.is_web_url(author_urls[0]): logger.info(f'Overriding author {author_urls[0]} with {g.user.web_url()}') if isinstance(authors[0], dict): @@ -573,7 +573,7 @@ def webmention_task(): logger.info('Wrapping in Update for home page user profile') actor_as1 = { **obj.as1, - 'id': g.user.ap_actor(), + 'id': g.user.web_url(), 'updated': util.now().isoformat(), } id = common.host_url(f'{obj.key.id()}#update-{util.now().isoformat()}') @@ -581,7 +581,7 @@ def webmention_task(): 'objectType': 'activity', 'verb': 'update', 'id': id, - 'actor': g.user.ap_actor(), + 'actor': g.user.web_url(), 'object': actor_as1, })