kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
aa5701e158
commit
71cb803840
4
pages.py
4
pages.py
|
@ -74,7 +74,7 @@ def load_user(protocol, id):
|
||||||
|
|
||||||
if cls.ABBREV != 'web':
|
if cls.ABBREV != 'web':
|
||||||
if not user:
|
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:
|
if user and user.use_instead:
|
||||||
user = user.use_instead.get()
|
user = user.use_instead.get()
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ def load_user(protocol, id):
|
||||||
elif user and id != user.key.id(): # use_instead redirect
|
elif user and id != user.key.id(): # use_instead redirect
|
||||||
error('', status=302, location=user.user_page_path())
|
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
|
assert not user.use_instead
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,7 @@ class PagesTest(TestCase):
|
||||||
self.assert_equals(404, got.status_code)
|
self.assert_equals(404, got.status_code)
|
||||||
|
|
||||||
def test_user_not_direct(self):
|
def test_user_not_direct(self):
|
||||||
fake = self.make_user('fake:foo', cls=Fake, direct=False)
|
got = self.client.get('/web/user.com')
|
||||||
got = self.client.get('/fake/fake:foo')
|
|
||||||
self.assert_equals(200, got.status_code)
|
self.assert_equals(200, got.status_code)
|
||||||
|
|
||||||
fake = self.make_user('http://fo/o', cls=ActivityPub, direct=False)
|
fake = self.make_user('http://fo/o', cls=ActivityPub, direct=False)
|
||||||
|
|
Ładowanie…
Reference in New Issue