kopia lustrzana https://github.com/snarfed/bridgy-fed
activitypub.postprocess_as2: hashtags: use activity id's domain for href
for https://github.com/snarfed/bridgy-fed/issues/1013pull/1067/head
rodzic
ec350e7fa6
commit
9243e18a4f
|
@ -731,8 +731,8 @@ def postprocess_as2(activity, orig_obj=None, wrap=True):
|
|||
name = tag.get('name')
|
||||
if name and tag.get('type', 'Tag') == 'Tag':
|
||||
tag['type'] = 'Hashtag'
|
||||
tag.setdefault('href', common.host_url(
|
||||
f'hashtag/{quote_plus(name.removeprefix("#"))}'))
|
||||
url_path = f'/hashtag/{quote_plus(name.removeprefix("#"))}'
|
||||
tag.setdefault('href', urljoin(activity['id'], url_path))
|
||||
if not name.startswith('#'):
|
||||
tag['name'] = f'#{name}'
|
||||
|
||||
|
|
|
@ -1997,7 +1997,7 @@ class ActivityPubUtilsTest(TestCase):
|
|||
self.assert_equals({
|
||||
'tag': [
|
||||
{'type': 'Hashtag', 'name': '#bar', 'href': 'bar'},
|
||||
{'type': 'Hashtag', 'name': '#baz', 'href': 'http://localhost/hashtag/baz'},
|
||||
{'type': 'Hashtag', 'name': '#baz', 'href': '/hashtag/baz'},
|
||||
{'type': 'Mention', 'href': 'foo'},
|
||||
],
|
||||
'to': [as2.PUBLIC_AUDIENCE],
|
||||
|
|
Ładowanie…
Reference in New Issue