diff --git a/hc/front/tests/test_add_pushover.py b/hc/front/tests/test_add_pushover.py index a9ff4761..edb97d9a 100644 --- a/hc/front/tests/test_add_pushover.py +++ b/hc/front/tests/test_add_pushover.py @@ -17,10 +17,6 @@ class AddPushoverTestCase(BaseTestCase): r = self.client.get(self.url) self.assertEqual(r.status_code, 404) - def test_instructions_work_without_login(self): - r = self.client.get("/integrations/add_pushover/") - self.assertContains(r, "Setup Guide") - def test_it_shows_form(self): self.client.login(username="alice@example.org", password="password") r = self.client.get(self.url) diff --git a/hc/front/tests/test_add_pushover_help.py b/hc/front/tests/test_add_pushover_help.py new file mode 100644 index 00000000..e41913b3 --- /dev/null +++ b/hc/front/tests/test_add_pushover_help.py @@ -0,0 +1,18 @@ +from django.test.utils import override_settings +from hc.test import BaseTestCase + + +@override_settings( + PUSHOVER_API_TOKEN="token", PUSHOVER_SUBSCRIPTION_URL="http://example.org" +) +class AddPushoverHelpTestCase(BaseTestCase): + url = "/integrations/add_pushover/" + + @override_settings(PUSHOVER_API_TOKEN=None) + def test_it_requires_api_token(self): + r = self.client.get(self.url) + self.assertEqual(r.status_code, 404) + + def test_instructions_work_without_login(self): + r = self.client.get(self.url) + self.assertContains(r, "Setup Guide") diff --git a/hc/front/views.py b/hc/front/views.py index 3bd045e3..23a5640f 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -1257,6 +1257,7 @@ def add_discord_complete(request): return redirect("hc-p-channels", project.code) +@require_setting("PUSHOVER_API_TOKEN") def add_pushover_help(request): ctx = {"page": "channels"} return render(request, "integrations/add_pushover_help.html", ctx) diff --git a/static/img/integrations/setup_pdc_0.png b/static/img/integrations/setup_pdc_0.png index e23d380a..fbde09e7 100644 Binary files a/static/img/integrations/setup_pdc_0.png and b/static/img/integrations/setup_pdc_0.png differ diff --git a/static/img/integrations/setup_pushover_0.png b/static/img/integrations/setup_pushover_0.png new file mode 100644 index 00000000..a18fd8a3 Binary files /dev/null and b/static/img/integrations/setup_pushover_0.png differ diff --git a/static/img/integrations/setup_slack_btn_0.png b/static/img/integrations/setup_slack_btn_0.png new file mode 100644 index 00000000..ab8f6b38 Binary files /dev/null and b/static/img/integrations/setup_slack_btn_0.png differ diff --git a/templates/integrations/add_pushover_help.html b/templates/integrations/add_pushover_help.html index 60874f96..29487196 100644 --- a/templates/integrations/add_pushover_help.html +++ b/templates/integrations/add_pushover_help.html @@ -8,17 +8,27 @@

Pushover

+ {% if request.user.is_authenticated %}

- {% site_name %} is a free and - open source - service for monitoring your cron jobs, background processes and - scheduled tasks. Before adding Pushover integration, please log into - {% site_name %}:

+ Pushover delivers + real-time notifications on your Android, iPhone, iPad, Desktop, + Android Wear and Apple Watch. You can set up {% site_name %} to + receive Pushover notifications in a few simple steps. +

+ {% else %} +

+ {% site_name %} is a free and + open source + service for monitoring your cron jobs, background processes and + scheduled tasks. Before adding Pushover integration, please log into + {% site_name %}: +

+ {% endif %}

Setup Guide

@@ -27,7 +37,29 @@

- After logging in, go to "Integrations → Add Pushover". + {% if request.user.is_authenticated %} + Go + {% else %} + After logging in, go + {% endif %} + + to the Integrations page, + and click on Add Integration next to the + Pushover integration. +

+
+
+ Screenshot +
+
+ +
+
+ +

Pushover supports different notification priorities from silent to "Emergency". Select your preferred priorities and click "Subscribe with Pushover". diff --git a/templates/integrations/add_slack_btn.html b/templates/integrations/add_slack_btn.html index c5f32151..67c3c234 100644 --- a/templates/integrations/add_slack_btn.html +++ b/templates/integrations/add_slack_btn.html @@ -13,6 +13,7 @@ up {% site_name %} to post status updates directly to an appropriate Slack channel.

+ {% if authorize_url %} + {% endif %} {% else %}

@@ -39,12 +41,36 @@

Setup Guide

+ {% if not authorize_url %} +
+
+ +

+ {% if request.user.is_authenticated %} + Go + {% else %} + After logging in, go + {% endif %} + + to the Integrations page, + and click on Add Integration next to the + Slack integration. +

+
+
+ Screenshot +
+
+ {% endif %} +

- After {% if request.user.is_authenticated %}{% else %}signing in and{% endif %} - clicking on "Add to Slack", you should + Click on the "Add to Slack" button, and you should be on a page that says "{% site_name %} would like access to your Slack team". Select the team you want to add the {% site_name %} integration app to.