bug fix for bad profile link on followers page

fixes #934
pull/935/head
Ryan Barrett 2024-04-01 23:06:25 -07:00
rodzic 10e5b00dd6
commit f1531b44e7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 15 dodań i 1 usunięć

Wyświetl plik

@ -91,7 +91,7 @@ class ActivityPub(User, Protocol):
def web_url(self):
"""Returns this user's web URL aka web_url, eg ``https://foo.com/``."""
if self.obj and self.obj.as1:
url = util.get_url(self.obj.as1)
url = as1.get_url(self.obj.as1)
if url:
return url

Wyświetl plik

@ -35,6 +35,7 @@ with app.test_request_context('/'):
logger = logging.getLogger(__name__)
TEMPLATE_VARS = {
'as1': as1,
'as2': as2,
'g': g,
'isinstance': isinstance,

Wyświetl plik

@ -2259,6 +2259,19 @@ class ActivityPubUtilsTest(TestCase):
})
self.assertEqual('me.mas.to.ap.brid.gy', user.handle_as('atproto'))
def test_web_url_composite_url_object(self):
actor_as2 = {
'type': 'Person',
'url': 'https://techhub.social/@foo',
'attachment': [{
'type': 'PropertyValue',
'name': 'Twitter',
'value': '<span class="h-card"><a href="https://techhub.social/@foo" class="u-url mention">@<span>foo</span></a></span>',
}],
}
user = self.make_user('http://foo/actor', cls=ActivityPub, obj_as2=actor_as2)
self.assertEqual('https://techhub.social/@foo', user.web_url())
def test_web_url(self):
user = self.make_user('http://foo/actor', cls=ActivityPub)
self.assertEqual('http://foo/actor', user.web_url())