From 499720a1567a6f82e2e0ac49ef60579bae3904c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 10 Apr 2019 12:46:10 +0300 Subject: [PATCH] Hide the "Confirmation Needed" notice if email channel verification is turned off. Update changelog. --- CHANGELOG.md | 1 + hc/front/tests/test_add_email.py | 7 +++++++ hc/front/views.py | 1 + templates/integrations/add_email.html | 2 ++ 4 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b590cade..e9c8498a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Improvements - Add the EMAIL_USE_VERIFICATION configuration setting (#232) - Show "Badges" and "Settings" in top navigation (#234) +- Upgrade to Django 2.2 ## 1.6.0 - 2019-04-01 diff --git a/hc/front/tests/test_add_email.py b/hc/front/tests/test_add_email.py index b3bc891d..13830987 100644 --- a/hc/front/tests/test_add_email.py +++ b/hc/front/tests/test_add_email.py @@ -12,6 +12,7 @@ class AddEmailTestCase(BaseTestCase): self.client.login(username="alice@example.org", password="password") r = self.client.get(self.url) self.assertContains(r, "Get an email message") + self.assertContains(r, "Confirmation needed") def test_it_creates_channel(self): form = {"value": "alice@example.org"} @@ -58,6 +59,12 @@ class AddEmailTestCase(BaseTestCase): c = Channel.objects.get() self.assertEqual(c.value, "alice@example.org") + @override_settings(EMAIL_USE_VERIFICATION=False) + def test_it_hides_confirmation_needed_notice(self): + self.client.login(username="alice@example.org", password="password") + r = self.client.get(self.url) + self.assertNotContains(r, "Confirmation needed") + @override_settings(EMAIL_USE_VERIFICATION=False) def test_it_auto_verifies_email(self): form = {"value": "alice@example.org"} diff --git a/hc/front/views.py b/hc/front/views.py index 76952689..76992785 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -698,6 +698,7 @@ def add_email(request): ctx = { "page": "channels", "project": request.project, + "use_verification": settings.EMAIL_USE_VERIFICATION, "form": form } return render(request, "integrations/add_email.html", ctx) diff --git a/templates/integrations/add_email.html b/templates/integrations/add_email.html index 2450fb24..9149a044 100644 --- a/templates/integrations/add_email.html +++ b/templates/integrations/add_email.html @@ -16,11 +16,13 @@ Add multiple email addresses, to notify multiple team members.

+ {% if use_verification %}

Confirmation needed. After entering an email address, {% site_name %} will send out a confirmation link. Only confirmed addresses will receive notifications.

+ {% endif %}

Integration Settings