diff --git a/models.py b/models.py index 88c81f4d..f99b1719 100644 --- a/models.py +++ b/models.py @@ -671,9 +671,10 @@ class User(StringIdModel, metaclass=ProtocolUserMeta): return f"""\ - + {img} - {util.ellipsize(self.name(), chars=40)} {maybe_handle} + {util.ellipsize(self.name(), chars=40)} + {util.ellipsize(maybe_handle, chars=40)} """ def profile_picture(self): diff --git a/templates/user_base.html b/templates/user_base.html index 93ebdc12..c9cacc67 100644 --- a/templates/user_base.html +++ b/templates/user_base.html @@ -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) %} · - + {% if url %} {% endif %} - {{ user.handle_as(proto) }} + {{ util.ellipsize(handle, chars=40) }} {% if url %} {% endif %} {% endif %} diff --git a/tests/test_common.py b/tests/test_common.py index 9cbdd2fd..743aedf7 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -31,7 +31,7 @@ class CommonTest(TestCase): # current user's homepage gets converted to BF user page self.assert_multiline_equals("""\ - + user.com """, common.pretty_link('https://user.com/', user=Web(id='user.com')), ignore_blanks=True) diff --git a/tests/test_models.py b/tests/test_models.py index d94e4e09..3e5c941a 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -173,17 +173,17 @@ class UserTest(TestCase): def test_user_link(self): self.assert_multiline_equals("""\ - + y.z """, self.user.user_link(), ignore_blanks=True) self.user.obj = Object(id='a', as2=ACTOR) self.assert_multiline_equals("""\ - + Mrs. ☕ Foo -""", self.user.user_link()) +""", 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):