kopia lustrzana https://github.com/snarfed/bridgy-fed
store home page URL in update profile Objects, render better in activities UI
fixes #407pull/413/head
rodzic
52c6aa6160
commit
b5a0386cd0
13
pages.py
13
pages.py
|
@ -207,12 +207,15 @@ def fetch_objects(query, user):
|
|||
or inner_obj.get('displayName')
|
||||
or inner_obj.get('summary'))
|
||||
url = util.get_first(inner_obj, 'url') or inner_obj.get('id')
|
||||
if url:
|
||||
content = common.pretty_link(url, text=content, user=user)
|
||||
elif (obj.domains and
|
||||
obj_as1.get('id', '').strip('/') == f'https://{obj.domains[0]}'):
|
||||
if (obj.domains and
|
||||
inner_obj.get('id', '').strip('/') == f'https://{obj.domains[0]}'):
|
||||
obj.phrase = 'updated'
|
||||
obj_as1['content'] = 'their profile'
|
||||
obj_as1.update({
|
||||
'content': 'their profile',
|
||||
'url': f'https://{obj.domains[0]}',
|
||||
})
|
||||
elif url:
|
||||
content = common.pretty_link(url, text=content, user=user)
|
||||
|
||||
obj.content = (obj_as1.get('content')
|
||||
or obj_as1.get('displayName')
|
||||
|
|
|
@ -1102,10 +1102,12 @@ class WebmentionTest(testutil.TestCase):
|
|||
))
|
||||
|
||||
id = 'https://orig/#update-2022-01-02T03:04:05+00:00'
|
||||
wrapped_id = f'http://localhost/r/{id}'
|
||||
self.assert_deliveries(mock_post, ('https://shared/inbox', 'https://inbox'), {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'type': 'Update',
|
||||
'id': f'http://localhost/r/{id}',
|
||||
'id': wrapped_id,
|
||||
'url': wrapped_id,
|
||||
'actor': 'http://localhost/orig',
|
||||
'object': {
|
||||
**ACTOR_AS2_FULL,
|
||||
|
@ -1116,6 +1118,7 @@ class WebmentionTest(testutil.TestCase):
|
|||
|
||||
expected_as1 = {
|
||||
'id': id,
|
||||
'url': id,
|
||||
'objectType': 'activity',
|
||||
'verb': 'update',
|
||||
'object': ACTOR_AS1_UNWRAPPED,
|
||||
|
|
|
@ -63,12 +63,14 @@ class Webmention(View):
|
|||
'objectType': 'activity',
|
||||
'verb': 'update',
|
||||
'id': id,
|
||||
'url': id,
|
||||
'object': actor_as1,
|
||||
}
|
||||
self.source_as2 = common.postprocess_as2({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'type': 'Update',
|
||||
'id': common.host_url(f'{source}#update-{util.now().isoformat()}'),
|
||||
'id': id,
|
||||
'url': id,
|
||||
'object': actor_as2,
|
||||
}, user=self.user)
|
||||
return self.try_activitypub() or 'No ActivityPub targets'
|
||||
|
|
Ładowanie…
Reference in New Issue