diff --git a/hc/front/tests/test_channels.py b/hc/front/tests/test_channels.py index ab194d30..e6f9ac73 100644 --- a/hc/front/tests/test_channels.py +++ b/hc/front/tests/test_channels.py @@ -47,3 +47,10 @@ class ChannelsTestCase(BaseTestCase): self.assertEqual(r.status_code, 200) self.assertContains(r, "fake-key") self.assertContains(r, "(normal priority)") + + def test_it_shows_added_message(self): + self.client.login(username="alice@example.org", password="password") + r = self.client.get("/integrations/?added=hipchat") + + self.assertEqual(r.status_code, 200) + self.assertContains(r, "The HipChat integration has been added!") diff --git a/hc/front/views.py b/hc/front/views.py index 6eb24d85..dee951c0 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -1,6 +1,5 @@ from collections import Counter from datetime import datetime, timedelta as td -from itertools import tee import json from croniter import croniter @@ -11,7 +10,7 @@ from django.contrib.auth.decorators import login_required from django.core import signing from django.db.models import Count from django.http import (Http404, HttpResponse, HttpResponseBadRequest, - HttpResponseForbidden, JsonResponse) + HttpResponseForbidden) from django.shortcuts import get_object_or_404, redirect, render from django.template.loader import render_to_string from django.urls import reverse @@ -34,14 +33,6 @@ from pytz.exceptions import UnknownTimeZoneError import requests -# from itertools recipes: -def pairwise(iterable): - "s -> (s0,s1), (s1,s2), (s2, s3), ..." - a, b = tee(iterable) - next(b, None) - return zip(a, b) - - @login_required def my_checks(request): q = Check.objects.filter(user=request.team.user).order_by("created") @@ -140,6 +131,7 @@ def docs_api(request): return render(request, "front/docs_api.html", ctx) + def docs_cron(request): ctx = {"page": "docs", "section": "cron"} return render(request, "front/docs_cron.html", ctx) @@ -358,8 +350,10 @@ def channels(request): "enable_pushover": settings.PUSHOVER_API_TOKEN is not None, "enable_discord": settings.DISCORD_CLIENT_ID is not None, "enable_telegram": settings.TELEGRAM_TOKEN is not None, - "enable_sms": settings.TWILIO_AUTH is not None + "enable_sms": settings.TWILIO_AUTH is not None, + "added": request.GET.get("added") } + return render(request, "front/channels.html", ctx) diff --git a/static/img/integrations/setup_hipchat_4.png b/static/img/integrations/setup_hipchat_4.png new file mode 100644 index 00000000..77396052 Binary files /dev/null and b/static/img/integrations/setup_hipchat_4.png differ diff --git a/templates/front/channels.html b/templates/front/channels.html index 713b25a7..ec3daab8 100644 --- a/templates/front/channels.html +++ b/templates/front/channels.html @@ -6,11 +6,16 @@ {% block content %}
+ The HipChat integration has been added! +
+ {% endif %}After {% if request.user.is_authenticated %}{% else %}logging in and{% endif %} clicking on "Install HipChat Integration", you will be @@ -78,7 +78,7 @@
Next, HipChat will let you select the chat room for receiving {% site_name %} notifications. @@ -94,14 +94,11 @@
- As the final step, HipChat will show you the permissions + Next, HipChat will show you the permissions requested by {% site_name %}. There's only one permission - needed–"Send Notification". After clicking on "Approve" - you will be redirected back to - "Integrations" page on {% site_name %} and see - the new integration! + needed: "Send Notification".
+ That is all! You will now be redirected back to + "Integrations" page on {% site_name %} and see + the new integration! +
+