From 9da4b58c8e4b74dea35a6e0c0eb3cbc5e39d22ef Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 6 Dec 2018 10:11:02 -0800 Subject: [PATCH] docs: Fix /help/ sidebar being accidentally missing. Apparently, we didn't have a test for this, and it was broken in a recent refactoring. --- zerver/tests/test_docs.py | 4 +++- zerver/views/integrations.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py index 770edde42f..e8e230050e 100644 --- a/zerver/tests/test_docs.py +++ b/zerver/tests/test_docs.py @@ -171,8 +171,10 @@ class DocPageTest(ZulipTestCase): class HelpTest(ZulipTestCase): def test_help_settings_links(self) -> None: result = self.client_get('/help/change-the-time-format') - self.assertIn('Go to Display settings', str(result.content)) self.assertEqual(result.status_code, 200) + self.assertIn('Go to Display settings', str(result.content)) + # Check that the sidebar was rendered properly. + self.assertIn('Getting started with Zulip', str(result.content)) with self.settings(ROOT_DOMAIN_LANDING_PAGE=True): result = self.client_get('/help/change-the-time-format', subdomain="") diff --git a/zerver/views/integrations.py b/zerver/views/integrations.py index 836e05beb2..db107d320e 100644 --- a/zerver/views/integrations.py +++ b/zerver/views/integrations.py @@ -71,9 +71,10 @@ class MarkdownDirectoryView(ApiURLView): elif "/" in article: article = "missing" http_status = 404 - if len(article) > 100 or not re.match('^[0-9a-zA-Z_-]+$', article): + elif len(article) > 100 or not re.match('^[0-9a-zA-Z_-]+$', article): article = "missing" http_status = 404 + path = self.path_template % (article,) try: loader.get_template(path)