Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integration-docs: Add context properties for PythonAPIIntegrations.

Niloth P82ddc73df76b
diff --git a/templates/zerver/integrations/include/change-zulip-config-file.md b/templates/zerver/integrations/include/change-zulip-config-file.md
index c3e6b46bd2f..c0fa8b99e4e 100644
--- a/templates/zerver/integrations/include/change-zulip-config-file.md
+++ b/templates/zerver/integrations/include/change-zulip-config-file.md
@@ -1,6 +1,6 @@
-Open `/usr/local/share/zulip/integrations/{{ integration_name }}/zulip_{{ integration_name }}_config.py`
-with your favorite editor, and change the following lines to specify the
-email address and API key for your {{ integration_display_name }} bot:
+Open `{{ config_file_path}}` with your favorite editor, and change the
+following lines to specify the email address and API key for your
+{{ integration_display_name }} bot:
```
ZULIP_USER = "{{ integration_name }}[email protected]"
diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py
index 9531477ceb7..4ebb197007e 100644
--- a/zerver/views/documentation.py
+++ b/zerver/views/documentation.py
@@ -24,6 +24,7 @@ from zerver.lib.integrations import (
INTEGRATIONS,
META_CATEGORY,
HubotIntegration,
+ PythonAPIIntegration,
WebhookIntegration,
get_all_event_types_for_integration,
)
@@ -388,6 +389,13 @@ def integration_doc(request: HttpRequest, *, integration_name: PathOnly[str]) ->
context["all_event_types"] = all_event_types
if isinstance(integration, HubotIntegration):
context["hubot_docs_url"] = integration.hubot_docs_url
+ if isinstance(integration, PythonAPIIntegration):
+ context["config_file_path"] = (
+ f"/usr/local/share/zulip/integrations/{integration.directory_name}/zulip_{integration.directory_name}_config.py"
+ )
+ context["integration_path"] = (
+ f"/usr/local/share/zulip/integrations/{integration.directory_name}"
+ )
doc_html_str = render_markdown_path(integration.doc, context, integration_doc=True)