mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
portico: Provide isolated single-page versions of /terms and /privacy .
The `isolated_page` context flag we rely on was added in the parent commit.
This commit is contained in:
@@ -560,3 +560,18 @@ class PrivacyTermsTest(ZulipTestCase):
|
||||
with self.settings(PRIVACY_POLICY=abs_path):
|
||||
response = self.client_get('/privacy/')
|
||||
self.assert_in_success_response(['This is some <em>bold text</em>.'], response)
|
||||
|
||||
def test_no_nav(self) -> None:
|
||||
# Test that our ?nav=0 feature of /privacy and /terms,
|
||||
# designed to comply with the Apple App Store draconian
|
||||
# policies that ToS/Privacy pages linked from an iOS app have
|
||||
# no links to the rest of the site if there's pricing
|
||||
# information for anything elsewhere on the site.
|
||||
response = self.client_get("/terms/")
|
||||
self.assert_in_success_response(["Plans"], response)
|
||||
|
||||
response = self.client_get("/terms/?nav=no")
|
||||
self.assert_not_in_success_response(["Plans"], response)
|
||||
|
||||
response = self.client_get("/privacy/?nav=no")
|
||||
self.assert_not_in_success_response(["Plans"], response)
|
||||
|
||||
@@ -39,3 +39,15 @@ def team_view(request: HttpRequest) -> HttpResponse:
|
||||
'date': data['date'],
|
||||
},
|
||||
)
|
||||
|
||||
def get_isolated_page(request: HttpRequest) -> bool:
|
||||
'''Accept a GET param `?nav=no` to render an isolated, navless page.'''
|
||||
return request.GET.get('nav') == 'no'
|
||||
|
||||
def terms_view(request: HttpRequest) -> HttpResponse:
|
||||
return render(request, 'zerver/terms.html',
|
||||
context={'isolated_page': get_isolated_page(request)})
|
||||
|
||||
def privacy_view(request: HttpRequest) -> HttpResponse:
|
||||
return render(request, 'zerver/privacy.html',
|
||||
context={'isolated_page': get_isolated_page(request)})
|
||||
|
||||
@@ -563,8 +563,8 @@ i18n_urls = [
|
||||
url(r'^atlassian/$', TemplateView.as_view(template_name='zerver/atlassian.html')),
|
||||
|
||||
# Terms of Service and privacy pages.
|
||||
url(r'^terms/$', TemplateView.as_view(template_name='zerver/terms.html'), name='terms'),
|
||||
url(r'^privacy/$', TemplateView.as_view(template_name='zerver/privacy.html'), name='privacy'),
|
||||
url(r'^terms/$', zerver.views.portico.terms_view, name='terms'),
|
||||
url(r'^privacy/$', zerver.views.portico.privacy_view, name='privacy'),
|
||||
|
||||
url(r'^config-error/google$', TemplateView.as_view(
|
||||
template_name='zerver/config_error.html',),
|
||||
|
||||
Reference in New Issue
Block a user