From 60f9ea5f9c1b5189dab97eabbf3bca7cb4951b82 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 8 Jul 2020 15:49:32 +0100 Subject: [PATCH] Hide template ID and redaction for broadcast templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’re not going to have an API for sending broadcasts at the moment, so you don’t need the template ID for anything. Broadcast also won’t contain personal information, or tokenised links, etc, so there’s no need to redact them after sending. Removing this things means the interface is less cluttered. --- app/templates/views/templates/template.html | 10 +++--- tests/app/main/views/test_templates.py | 34 +++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index a4e1abe64..33885fe07 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -46,9 +46,11 @@ {% include 'views/templates/_template.html' %} -
- {{ api_key(template.id, name="Template ID", thing='template ID') }} -
+ {% if template.template_type != 'broadcast' %} +
+ {{ api_key(template.id, name="Template ID", thing='template ID') }} +
+ {% endif %}
{% if template._template.updated_at %} @@ -71,7 +73,7 @@   {% endif %} - {% if template.template_type != 'letter' %} + {% if template.template_type not in ('letter', 'broadcast') %} {% if not template._template.redact_personalisation %} Hide personalisation after sending diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index d44a2794f..5afea8600 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -728,6 +728,21 @@ def test_should_show_template_id_on_template_page( assert page.select('.api-key__key')[0].text == fake_uuid +def test_should_hide_template_id_for_broadcast_templates( + client_request, + mock_get_broadcast_template, + mock_get_template_folders, + fake_uuid, +): + page = client_request.get( + '.view_template', + service_id=SERVICE_ONE_ID, + template_id=fake_uuid, + _test_page_title=False, + ) + assert not page.select('.api-key__key') + + def test_should_show_sms_template_with_downgraded_unicode_characters( client_request, mocker, @@ -2256,6 +2271,25 @@ def test_should_not_show_redaction_stuff_for_letters( ) +def test_should_not_show_redaction_stuff_for_broadcasts( + client_request, + fake_uuid, + mock_get_broadcast_template, + mock_get_template_folders, +): + page = client_request.get( + 'main.view_template', + service_id=SERVICE_ONE_ID, + template_id=fake_uuid, + _test_page_title=False, + ) + + assert page.select('.hint') == [] + assert 'personalisation' not in ' '.join( + link.text.lower() for link in page.select('a') + ) + + def test_set_template_sender( client_request, fake_uuid,