kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
10e5b00dd6
commit
f1531b44e7
|
@ -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
|
||||
|
||||
|
|
1
pages.py
1
pages.py
|
@ -35,6 +35,7 @@ with app.test_request_context('/'):
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
TEMPLATE_VARS = {
|
||||
'as1': as1,
|
||||
'as2': as2,
|
||||
'g': g,
|
||||
'isinstance': isinstance,
|
||||
|
|
|
@ -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())
|
||||
|
|
Ładowanie…
Reference in New Issue