kopia lustrzana https://github.com/snarfed/bridgy-fed
Object.actor_link bug fix: handle composite url field
fixes https://console.cloud.google.com/errors/detail/CJTXq6ri48XtKQ;time=P30D?project=bridgy-federatedpull/714/head
rodzic
625eb66d53
commit
1f6a227aee
|
@ -862,7 +862,7 @@ class Object(StringIdModel):
|
|||
elif set(actor.keys()) == {'id'}:
|
||||
return common.pretty_link(actor['id'], attrs=attrs)
|
||||
|
||||
url = util.get_first(actor, 'url') or ''
|
||||
url = as1.get_url(actor)
|
||||
name = actor.get('displayName') or actor.get('username') or ''
|
||||
img_url = util.get_url(actor, 'image')
|
||||
if not image or not img_url:
|
||||
|
|
|
@ -488,6 +488,18 @@ class ObjectTest(TestCase):
|
|||
Alice
|
||||
</a>""", obj.actor_link(sized=True))
|
||||
|
||||
def test_actor_link_composite_url(self):
|
||||
obj = Object(id='x', our_as1={
|
||||
'actor': {
|
||||
'url': {
|
||||
'value': 'https://mas.to/@foo',
|
||||
}
|
||||
},
|
||||
})
|
||||
self.assert_multiline_equals(
|
||||
'<a class="h-card u-author" href="https://mas.to/@foo">mas.to/@foo</a>',
|
||||
obj.actor_link(image=False))
|
||||
|
||||
def test_put_updates_load_cache(self):
|
||||
obj = Object(id='x', as2={})
|
||||
obj.put()
|
||||
|
|
Ładowanie…
Reference in New Issue