Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
documentation: Support having no sidebar for policies docs.
Alex Vandiver9c336e43743b
diff --git a/templates/zerver/policies_minimal/privacy.md b/templates/zerver/policies_minimal/privacy.mdnew file mode 100644index 00000000000..5d35b199145--- /dev/null+++ b/templates/zerver/policies_minimal/privacy.md@@ -0,0 +1 @@+This is the custom privacy policy.diff --git a/templates/zerver/policies_minimal/terms.md b/templates/zerver/policies_minimal/terms.mdnew file mode 100644index 00000000000..f457f38e7fd--- /dev/null+++ b/templates/zerver/policies_minimal/terms.md@@ -0,0 +1 @@+These are the custom terms and conditions.diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.pyindex b34b2681121..9b65d5898e5 100644--- a/zerver/tests/test_docs.py+++ b/zerver/tests/test_docs.py@@ -694,6 +694,10 @@ class PrivacyTermsTest(ZulipTestCase):response = self.client_get("/policies/terms")self.assert_in_response(not_configured_message, response)+ with self.settings(POLICIES_DIRECTORY="zerver/policies_minimal"):+ response = self.client_get("/policies/terms")+ self.assert_in_success_response(["These are the custom terms and conditions."], response)+with self.settings(POLICIES_DIRECTORY="corporate/policies"):response = self.client_get("/policies/terms")self.assert_in_success_response(["Kandra Labs"], response)@@ -704,6 +708,10 @@ class PrivacyTermsTest(ZulipTestCase):response = self.client_get("/policies/privacy")self.assert_in_response(not_configured_message, response)+ with self.settings(POLICIES_DIRECTORY="zerver/policies_minimal"):+ response = self.client_get("/policies/privacy")+ self.assert_in_success_response(["This is the custom privacy policy."], response)+with self.settings(POLICIES_DIRECTORY="corporate/policies"):response = self.client_get("/policies/privacy")self.assert_in_success_response(["Kandra Labs"], response)diff --git a/zerver/views/documentation.py b/zerver/views/documentation.pyindex 682e5fe2ea4..a690f4f6f0d 100644--- a/zerver/views/documentation.py+++ b/zerver/views/documentation.py@@ -182,7 +182,10 @@ class MarkdownDirectoryView(ApiURLView):context["doc_root"] = "/policies/"context["doc_root_title"] = "Terms and policies"sidebar_article = self.get_path("sidebar_index")- sidebar_index = sidebar_article.article_path+ if sidebar_article.article_http_status == 200:+ sidebar_index = sidebar_article.article_path+ else:+ sidebar_index = Nonetitle_base = "Zulip terms and policies"elif self.api_doc_view:context["page_is_api_center"] = True@@ -234,7 +237,10 @@ class MarkdownDirectoryView(ApiURLView):if endpoint_name and endpoint_method:context["api_url_context"]["API_ENDPOINT_NAME"] = endpoint_name + ":" + endpoint_method- sidebar_html = render_markdown_path(sidebar_index)+ if sidebar_index is not None:+ sidebar_html = render_markdown_path(sidebar_index)+ else:+ sidebar_html = ""tree = html.fragment_fromstring(sidebar_html, create_parent=True)if not context.get("page_is_policy_center", False):home_h1 = Element("h1")