diff --git a/templates/zerver/integrations/hubot_common.md b/templates/zerver/integrations/hubot_common.md new file mode 100644 index 0000000000..eabdc88c42 --- /dev/null +++ b/templates/zerver/integrations/hubot_common.md @@ -0,0 +1,8 @@ +Get Zulip notifications from {{ integration_display_name }} via Hubot! + +{!create-stream.md!} + +Next, [install Hubot](hubot), and test it to make sure it is working. + +Finally, [follow these instructions]({{ hubot_docs_url }}) to set up +the integration with {{ integration_display_name }}! diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index bdba1250ec..63b18f9f15 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -205,10 +205,14 @@ class HubotLozenge(Integration): if git_url is None: git_url = self.GIT_URL_TEMPLATE.format(name) - self.git_url = git_url + self.hubot_docs_url = git_url + super().__init__( name, name, categories, logo=logo, display_name=display_name, + # HACK: This isn't actually used. We'll rewrite this to + # `hubot_common.md` in `app_filters.py` + doc = 'zerver/integrations/%s.md' % (name,), legacy=legacy ) @@ -456,7 +460,6 @@ BOT_INTEGRATIONS = [ # Note: These are not actually displayed anywhere; we're keeping them # around so they can be migrated into the newer HUBOT_INTEGRATIONS HUBOT_LOZENGES_LEGACY = { - 'assembla': HubotLozenge('assembla', ['project-management', 'version-control']), 'bonusly': HubotLozenge('bonusly', ['hr']), 'chartbeat': HubotLozenge('chartbeat', ['marketing']), 'darksky': HubotLozenge('darksky', ['misc'], display_name='Dark Sky', logo_alt='Dark Sky logo'), @@ -470,8 +473,16 @@ HUBOT_LOZENGES_LEGACY = { 'youtube': HubotLozenge('youtube', ['misc'], display_name='YouTube', logo_alt='YouTube logo') } -for integration in WEBHOOK_INTEGRATIONS: - INTEGRATIONS[integration.name] = integration +HUBOT_INTEGRATIONS = { + HubotLozenge('assembla', ['version-control', 'project-management'], + display_name='Assembla', logo_alt='Assembla'), +} + +for hubot_integration in HUBOT_INTEGRATIONS: + INTEGRATIONS[hubot_integration.name] = hubot_integration + +for webhook_integration in WEBHOOK_INTEGRATIONS: + INTEGRATIONS[webhook_integration.name] = webhook_integration for bot_integration in BOT_INTEGRATIONS: INTEGRATIONS[bot_integration.name] = bot_integration diff --git a/zerver/templatetags/app_filters.py b/zerver/templatetags/app_filters.py index 7acf7321b4..ead62e1b34 100644 --- a/zerver/templatetags/app_filters.py +++ b/zerver/templatetags/app_filters.py @@ -98,6 +98,10 @@ def render_markdown_path(markdown_file_path, context=None): context['recommended_stream_name'] = integration.stream_name if hasattr(integration, 'url'): context['integration_url'] = integration.url[3:] + if hasattr(integration, 'hubot_docs_url'): + context['hubot_docs_url'] = integration.hubot_docs_url + # HACK: The actual file doesn't exist; we rewrite it here. + markdown_file_path = 'zerver/integrations/hubot_common.md' jinja = engines['Jinja2'] markdown_string = jinja.env.loader.get_source(jinja.env, markdown_file_path)[0]