genericize user handles on UI follower/following pages

pull/737/head
Ryan Barrett 2023-11-27 21:40:01 -08:00
rodzic 004726d397
commit 1ec1fc2482
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 6 dodań i 9 usunięć

Wyświetl plik

@ -168,8 +168,6 @@ def followers_or_following(protocol, id, collection):
f'{collection}.html',
address=request.args.get('address'),
follow_url=request.values.get('url'),
# TODO: remove
ActivityPub=PROTOCOLS['activitypub'],
**TEMPLATE_VARS,
**locals(),
)

Wyświetl plik

@ -11,8 +11,7 @@
{% endif %}
{% endwith %}
{{ user_as1.get('displayName') or '' }}
<!-- TODO: genericize -->
{{ as2.address(ActivityPub.convert(f.user.obj, from_user=user) or url) or url }}
{{ f.user.handle or url }}
</a>
{% endwith %}

Wyświetl plik

@ -167,14 +167,14 @@ class PagesTest(TestCase):
def test_followers(self):
Follower.get_or_create(
to=self.user,
from_=self.make_user('unused', cls=Fake, obj_as2={
from_=self.make_user('http://unused', cls=ActivityPub, obj_as2={
**ACTOR,
'id': 'unused',
'url': 'http://stored/users/follow',
}))
Follower.get_or_create(
to=self.user,
from_=self.make_user('masto/user', cls=Fake,
from_=self.make_user('http://masto/user', cls=ActivityPub,
obj_as2=ACTOR_WITH_PREFERRED_USERNAME))
got = self.client.get('/web/user.com/followers')
@ -261,14 +261,14 @@ class PagesTest(TestCase):
def test_following(self):
Follower.get_or_create(
from_=self.user,
to=self.make_user('unused', cls=Fake, obj_as2={
to=self.make_user('http://unused', cls=ActivityPub, obj_as2={
**ACTOR,
'id': 'unused',
'url': 'http://stored/users/follow',
}))
Follower.get_or_create(
from_=self.user,
to=self.make_user('masto/user', cls=Fake,
to=self.make_user('http://masto/user', cls=ActivityPub,
obj_as2=ACTOR_WITH_PREFERRED_USERNAME))
got = self.client.get('/web/user.com/following')
@ -276,7 +276,7 @@ class PagesTest(TestCase):
body = got.get_data(as_text=True)
self.assertIn('@follow@stored', body)
self.assertIn('masto/user', body)
self.assertIn('@me@plus.google.com', body)
def test_following_empty(self):
got = self.client.get('/web/user.com/following')