kopia lustrzana https://github.com/snarfed/bridgy-fed
ActivityPub.convert: omit acct: URIs
for #738, https://github.com/Automattic/wordpress-activitypub/issues/571pull/741/head
rodzic
911814dba2
commit
e079cec77c
|
@ -704,7 +704,7 @@ def postprocess_as2_actor(actor, user=None):
|
|||
assert isinstance(actor, dict)
|
||||
|
||||
url = user.web_url()
|
||||
urls = util.get_list(actor, 'url')
|
||||
urls = [u for u in util.get_list(actor, 'url') if u and not u.startswith('acct:')]
|
||||
if not urls and url:
|
||||
urls = [url]
|
||||
if urls:
|
||||
|
|
|
@ -1852,6 +1852,13 @@ class ActivityPubUtilsTest(TestCase):
|
|||
'value': '<a rel="me" href="https://two"><span class="invisible">https://</span>two</a>',
|
||||
}], got['attachment'])
|
||||
|
||||
def test_postprocess_as2_actor_strips_acct_url(self):
|
||||
self.assert_equals('http://localhost/r/http://user.com/',
|
||||
postprocess_as2_actor(as2.from_as1({
|
||||
'objectType': 'person',
|
||||
'urls': ['http://user.com/', 'acct:foo@bar'],
|
||||
}), user=self.user)['url'])
|
||||
|
||||
def test_postprocess_as2_actor_preserves_preferredUsername(self):
|
||||
# preferredUsername stays y.z despite user's username. since Mastodon
|
||||
# queries Webfinger for preferredUsername@fed.brid.gy
|
||||
|
|
Ładowanie…
Reference in New Issue