fix update profile Object id

use synthetic URL with #update-[timestamp] fragment, not just home page URL
pull/413/head
Ryan Barrett 2023-02-07 12:23:08 -08:00
rodzic 48252bf42d
commit 52c6aa6160
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -1101,10 +1101,11 @@ class WebmentionTest(testutil.TestCase):
self.req('https://orig/'),
))
id = 'https://orig/#update-2022-01-02T03:04:05+00:00'
self.assert_deliveries(mock_post, ('https://shared/inbox', 'https://inbox'), {
'@context': 'https://www.w3.org/ns/activitystreams',
'type': 'Update',
'id': 'http://localhost/r/https://orig/#update-2022-01-02T03:04:05+00:00',
'id': f'http://localhost/r/{id}',
'actor': 'http://localhost/orig',
'object': {
**ACTOR_AS2_FULL,
@ -1114,12 +1115,12 @@ class WebmentionTest(testutil.TestCase):
})
expected_as1 = {
'id': 'https://orig/#update-2022-01-02T03:04:05+00:00',
'id': id,
'objectType': 'activity',
'verb': 'update',
'object': ACTOR_AS1_UNWRAPPED,
}
self.assert_object(f'https://orig/',
self.assert_object(id,
domains=['orig'],
source_protocol='webmention',
status='complete',

Wyświetl plik

@ -138,7 +138,8 @@ class Webmention(View):
log_data = True
type = as1.object_type(self.source_as1)
obj = Object.get_by_id(self.source_url)
obj_id = self.source_as1.get('id') or self.source_url
obj = Object.get_by_id(obj_id)
changed = False
if obj:
@ -158,7 +159,7 @@ class Webmention(View):
logger.info(f'Content has changed from last time at {obj.updated}! Redelivering to all inboxes: {obj.undelivered}')
else:
obj = Object(id=self.source_url, delivered=[], failed=[],
obj = Object(id=obj_id, delivered=[], failed=[],
undelivered=[Target(uri=uri, protocol='activitypub')
for uri in inboxes_to_targets.keys()],
status='in progress')