kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
b20bbf0564
commit
349f4ba544
|
@ -671,9 +671,10 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
|
||||
return f"""\
|
||||
<span class="logo" title="{self.__class__.__name__}">{self.LOGO_HTML}</span>
|
||||
<a class="h-card u-author" href="{url}" title="{self.name()}">
|
||||
<a class="h-card u-author" href="{url}" title="{self.name()} {maybe_handle}">
|
||||
{img}
|
||||
{util.ellipsize(self.name(), chars=40)} {maybe_handle}
|
||||
{util.ellipsize(self.name(), chars=40)}
|
||||
{util.ellipsize(maybe_handle, chars=40)}
|
||||
</a>"""
|
||||
|
||||
def profile_picture(self):
|
||||
|
|
|
@ -44,11 +44,12 @@
|
|||
{% if proto and not isinstance(user, proto) and proto.LABEL not in ('ui', 'web')
|
||||
and user.is_enabled(proto) %}
|
||||
{% set url = proto.bridged_web_url_for(user) %}
|
||||
{% set handle = user.handle_as(proto) %}
|
||||
·
|
||||
<nobr title="{{ proto.__name__ }} (bridged)">
|
||||
<nobr title="{{ proto.__name__ }} (bridged): {{ handle }}">
|
||||
{% if url %} <a href="{{ url }}"> {% endif %}
|
||||
<span class="logo">{{ proto.LOGO_HTML|safe }}</span>
|
||||
{{ user.handle_as(proto) }}
|
||||
{{ util.ellipsize(handle, chars=40) }}
|
||||
{% if url %} </a> {% endif %}
|
||||
</nobr>
|
||||
{% endif %}
|
||||
|
|
|
@ -31,7 +31,7 @@ class CommonTest(TestCase):
|
|||
# current user's homepage gets converted to BF user page
|
||||
self.assert_multiline_equals("""\
|
||||
<span class="logo" title="Web">🌐</span>
|
||||
<a class="h-card u-author" href="/web/user.com" title="user.com">
|
||||
<a class="h-card u-author" href="/web/user.com" title="user.com ">
|
||||
user.com
|
||||
</a>""", common.pretty_link('https://user.com/', user=Web(id='user.com')),
|
||||
ignore_blanks=True)
|
||||
|
|
|
@ -173,17 +173,17 @@ class UserTest(TestCase):
|
|||
def test_user_link(self):
|
||||
self.assert_multiline_equals("""\
|
||||
<span class="logo" title="Web">🌐</span>
|
||||
<a class="h-card u-author" href="/web/y.z" title="y.z">
|
||||
<a class="h-card u-author" href="/web/y.z" title="y.z ">
|
||||
y.z
|
||||
</a>""", self.user.user_link(), ignore_blanks=True)
|
||||
|
||||
self.user.obj = Object(id='a', as2=ACTOR)
|
||||
self.assert_multiline_equals("""\
|
||||
<span class="logo" title="Web">🌐</span>
|
||||
<a class="h-card u-author" href="/web/y.z" title="Mrs. ☕ Foo">
|
||||
<a class="h-card u-author" href="/web/y.z" title="Mrs. ☕ Foo ">
|
||||
<img src="https://user.com/me.jpg" class="profile">
|
||||
Mrs. ☕ Foo
|
||||
</a>""", self.user.user_link())
|
||||
</a>""", self.user.user_link(), ignore_blanks=True)
|
||||
|
||||
def test_is_web_url(self):
|
||||
for url in 'y.z', '//y.z', 'http://y.z', 'https://y.z':
|
||||
|
@ -626,7 +626,7 @@ class ObjectTest(TestCase):
|
|||
obj = Object(id='x', source_protocol='ui', users=[self.user.key])
|
||||
|
||||
got = obj.actor_link(user=self.user)
|
||||
self.assertIn('href="web:fake:user" title="Alice">', got)
|
||||
self.assertIn('href="web:fake:user" title="Alice ">', got)
|
||||
self.assertIn('Alice', got)
|
||||
|
||||
def test_actor_link_object_in_datastore(self):
|
||||
|
|
Ładowanie…
Reference in New Issue