kopia lustrzana https://github.com/snarfed/bridgy-fed
show Web user page even when direct is False
not other protocols thoughpull/799/head
rodzic
86079c3684
commit
907e6e7aeb
16
pages.py
16
pages.py
|
@ -79,15 +79,15 @@ def load_user(protocol, id):
|
|||
elif user and id != user.key.id(): # use_instead redirect
|
||||
error('', status=302, location=user.user_page_path())
|
||||
|
||||
if not user or not user.direct:
|
||||
# TODO: switch back to USER_NOT_FOUND_HTML
|
||||
# not easy via exception/abort because this uses Werkzeug's built in
|
||||
# NotFound exception subclass, and we'd need to make it implement
|
||||
# get_body to return arbitrary HTML.
|
||||
error(f'{protocol} user {id} not found', status=404)
|
||||
if user and (user.direct or protocol == 'web'):
|
||||
assert not user.use_instead
|
||||
return user
|
||||
|
||||
assert not user.use_instead
|
||||
return user
|
||||
# TODO: switch back to USER_NOT_FOUND_HTML
|
||||
# not easy via exception/abort because this uses Werkzeug's built in
|
||||
# NotFound exception subclass, and we'd need to make it implement
|
||||
# get_body to return arbitrary HTML.
|
||||
error(f'{protocol} user {id} not found', status=404)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
|
|
|
@ -98,9 +98,11 @@ class PagesTest(TestCase):
|
|||
self.assert_equals(404, got.status_code)
|
||||
|
||||
def test_user_not_direct(self):
|
||||
self.user.direct = False
|
||||
self.user.put()
|
||||
got = self.client.get('/web/user.com')
|
||||
fake = self.make_user('fake:foo', cls=Fake)
|
||||
fake.direct = False
|
||||
fake.put()
|
||||
|
||||
got = self.client.get('/fake/fake:foo')
|
||||
self.assert_equals(404, got.status_code)
|
||||
|
||||
def test_user_opted_out(self):
|
||||
|
|
Ładowanie…
Reference in New Issue