Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
documentation: Clean up `MarkdownDirectoryView.get_context_data`.
Lauryn Menarde7cecc989f67
diff --git a/zerver/views/documentation.py b/zerver/views/documentation.pyindex 8a6903efb6c..ccb1fbd6b0f 100644--- a/zerver/views/documentation.py+++ b/zerver/views/documentation.py@@ -172,7 +172,7 @@ class MarkdownDirectoryView(ApiURLView):sidebar_article = self.get_path("include/sidebar_index")sidebar_index = sidebar_article.article_pathtitle_base = "Zulip help center"- elif self.path_template == f"{settings.POLICIES_DIRECTORY}/%s.md":+ elif self.policies_view:context["page_is_policy_center"] = Truecontext["doc_root"] = "/policies/"context["doc_root_title"] = "Terms and policies"@@ -193,7 +193,6 @@ class MarkdownDirectoryView(ApiURLView):if os.path.exists(article_absolute_path):with open(article_absolute_path) as article_file:first_line = article_file.readlines()[0]- # Strip the header and then use the first line to get the article titleif context["article"] == "/zerver/api/api-doc-template.md":endpoint_name, endpoint_method = (documentation_article.endpoint_path,@@ -209,6 +208,7 @@ class MarkdownDirectoryView(ApiURLView):endpoint_name, endpoint_method = get_endpoint_from_operationid(api_operation)article_title = get_openapi_summary(endpoint_name, endpoint_method)else:+ # Strip the header and then use the first line to get the article titlearticle_title = first_line.lstrip("#").strip()endpoint_name = endpoint_method = Noneif not_index_page: