user page bug fix for direct vs enabledd

need to drop direct!
pull/977/head
Ryan Barrett 2024-04-27 09:53:21 -07:00
rodzic aa5701e158
commit 71cb803840
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -74,7 +74,7 @@ def load_user(protocol, id):
if cls.ABBREV != 'web':
if not user:
user = cls.query(OR(cls.handle == id, cls.handle == id)).get()
user = cls.query(cls.handle == id).get()
if user and user.use_instead:
user = user.use_instead.get()
@ -84,7 +84,7 @@ def load_user(protocol, id):
elif user and id != user.key.id(): # use_instead redirect
error('', status=302, location=user.user_page_path())
if user and (user.direct or cls.ABBREV != 'ap'):
if user and (user.direct or user.enabled_protocols or cls.ABBREV == 'web'):
assert not user.use_instead
return user

Wyświetl plik

@ -99,8 +99,7 @@ class PagesTest(TestCase):
self.assert_equals(404, got.status_code)
def test_user_not_direct(self):
fake = self.make_user('fake:foo', cls=Fake, direct=False)
got = self.client.get('/fake/fake:foo')
got = self.client.get('/web/user.com')
self.assert_equals(200, got.status_code)
fake = self.make_user('http://fo/o', cls=ActivityPub, direct=False)