activitypub.actor: remove redundant preferredUsername

no clue why this triggered these flaky test failures, they happened when I ran all tests, but not test_pages on its own. grr.
as2-actor-ids
Ryan Barrett 2023-11-23 22:06:08 -08:00
rodzic f27e914a89
commit dcd7081d48
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 14 dodań i 18 usunięć

Wyświetl plik

@ -730,8 +730,14 @@ def postprocess_as2_actor(actor, wrap=True):
actor.setdefault('inbox', g.user.ap_actor('inbox'))
actor.setdefault('outbox', g.user.ap_actor('outbox'))
# This has to be the domain for Mastodon interop/Webfinger discovery!
# See related comment in actor() below.
# This has to be the id (domain for Web) for Mastodon etc interop! It
# seems like it should be the custom username from the acct: u-url in
# their h-card, but that breaks Mastodon's Webfinger discovery.
# Background:
# https://docs.joinmastodon.org/spec/activitypub/#properties-used-1
# https://docs.joinmastodon.org/spec/webfinger/#mastodons-requirements-for-webfinger
# https://github.com/snarfed/bridgy-fed/issues/302#issuecomment-1324305460
# https://github.com/snarfed/bridgy-fed/issues/77
actor['preferredUsername'] = g.user.handle_as(ActivityPub).strip('@').split('@')[0]
# Override the label for their home page to be "Web site"
@ -802,16 +808,6 @@ def actor(handle_or_id):
},
# add this if we ever change the Web actor ids to be /web/[id]
# 'alsoKnownAs': [host_url(id)],
# This has to be the id (domain for Web) for Mastodon etc interop! It
# seems like it should be the custom username from the acct: u-url in
# their h-card, but that breaks Mastodon's Webfinger discovery.
# Background:
# https://docs.joinmastodon.org/spec/activitypub/#properties-used-1
# https://docs.joinmastodon.org/spec/webfinger/#mastodons-requirements-for-webfinger
# https://github.com/snarfed/bridgy-fed/issues/302#issuecomment-1324305460
# https://github.com/snarfed/bridgy-fed/issues/77
'preferredUsername': user.handle_as(ActivityPub).strip('@').split('@')[0],
})
logger.info(f'Returning: {json_dumps(actor, indent=2)}')

Wyświetl plik

@ -52,7 +52,7 @@ class PagesTest(TestCase):
def test_user_fake(self):
self.make_user('fake:foo', cls=Fake)
got = self.client.get('/fa/fake:foo')
got = self.client.get('/fake/fake:foo')
self.assert_equals(200, got.status_code)
def test_user_page_handle(self):
@ -186,7 +186,7 @@ class PagesTest(TestCase):
def test_home_fake(self):
self.make_user('fake:foo', cls=Fake)
got = self.client.get('/fa/fake:foo/home')
got = self.client.get('/fake/fake:foo/home')
self.assert_equals(200, got.status_code)
def test_home_objects(self):
@ -196,7 +196,7 @@ class PagesTest(TestCase):
def test_notifications_fake(self):
self.make_user('fake:foo', cls=Fake)
got = self.client.get('/fa/fake:foo/notifications')
got = self.client.get('/fake/fake:foo/notifications')
self.assert_equals(200, got.status_code)
def test_notifications_objects(self):
@ -229,7 +229,7 @@ class PagesTest(TestCase):
def test_followers_fake(self):
self.make_user('fake:foo', cls=Fake)
got = self.client.get('/fa/fake:foo/followers')
got = self.client.get('/fake/fake:foo/followers')
self.assert_equals(200, got.status_code)
def test_followers_empty(self):
@ -273,7 +273,7 @@ class PagesTest(TestCase):
def test_following_fake(self):
self.make_user('fake:foo', cls=Fake)
got = self.client.get('/fa/fake:foo/following')
got = self.client.get('/fake/fake:foo/following')
self.assert_equals(200, got.status_code)
def test_following_user_not_found(self):
@ -304,7 +304,7 @@ class PagesTest(TestCase):
def test_feed_fake(self):
self.make_user('fake:foo', cls=Fake)
got = self.client.get('/fa/fake:foo/feed')
got = self.client.get('/fake/fake:foo/feed')
self.assert_equals(200, got.status_code)
def test_feed_html_empty(self):