From 8137f9c3a63c4f30a96d4709657ee38829cec5e1 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 7 Jun 2018 11:03:03 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20let=20people=20redact=20letter?= =?UTF-8?q?=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It doesn’t work, so we shouldn’t show the link. --- app/templates/views/templates/template.html | 14 +++++++------ tests/app/main/views/test_templates.py | 22 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index 3bf7cf785..627dcac69 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -70,12 +70,14 @@   {% endif %} - {% if not template._template.redact_personalisation %} - - Hide personalisation after sending - - {% else %} -

Personalisation is hidden after sending

+ {% if template.template_type != 'letter' %} + {% if not template._template.redact_personalisation %} + + Hide personalisation after sending + + {% else %} +

Personalisation is hidden after sending

+ {% endif %} {% endif %} {% endif %} diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index bf165333b..a7fbd5009 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -1241,6 +1241,28 @@ def test_should_show_hint_once_template_redacted( assert page.select('.hint')[0].text == 'Personalisation is hidden after sending' +def test_should_not_show_redaction_stuff_for_letters( + client_request, + mocker, + fake_uuid, + mock_get_service_letter_template, + single_letter_contact_block, +): + + mocker.patch('app.main.views.templates.get_page_count_for_letter', return_value=1) + + page = client_request.get( + 'main.view_template', + service_id=SERVICE_ONE_ID, + template_id=fake_uuid, + ) + + 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,