diff --git a/app/assets/stylesheets/components/page-footer.scss b/app/assets/stylesheets/components/page-footer.scss index 5354d8901..2d668b5a5 100644 --- a/app/assets/stylesheets/components/page-footer.scss +++ b/app/assets/stylesheets/components/page-footer.scss @@ -42,6 +42,7 @@ &-delete-link-without-button { @include core-19; padding-left: 0; + display: inline-block; } &-secondary-link { diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index 436d4ab60..fb98e8a90 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -50,14 +50,16 @@
{% endif %} {% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %} - + Delete this template   - {% if not template.redact_personalisation %} + {% if not template._template.redact_personalisation %} Hide personalisation after sending + {% else %} +

Personalisation is hidden after sending

{% endif %} {% endif %} diff --git a/tests/__init__.py b/tests/__init__.py index aeabd6426..a3c1e0b4a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -91,7 +91,9 @@ def template_json(service_id, subject=None, version=1, archived=False, - process_type='normal'): + process_type='normal', + redact_personalisation=False, + ): template = { 'id': id_, 'name': name, @@ -101,10 +103,12 @@ def template_json(service_id, 'version': version, 'updated_at': datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f'), 'archived': archived, - 'process_type': process_type + 'process_type': process_type, } if subject is not None: template['subject'] = subject + if redact_personalisation is not None: + template['redact_personalisation'] = redact_personalisation return template diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 6fea6d70f..fccf008ce 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -987,3 +987,21 @@ def test_should_show_redact_template( ) mock_redact_template.assert_called_once_with(SERVICE_ONE_ID, fake_uuid) + + +def test_should_show_hint_once_template_redacted( + client_request, + mocker, + service_one, + fake_uuid, +): + + mock_get_service_email_template(mocker, redact_personalisation=True) + + page = client_request.get( + 'main.view_template', + service_id=SERVICE_ONE_ID, + template_id=fake_uuid, + ) + + assert page.select('.hint')[0].text == 'Personalisation is hidden after sending' diff --git a/tests/conftest.py b/tests/conftest.py index 19fd28b09..410ccb5a5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -351,7 +351,7 @@ def mock_get_service_template_with_placeholders(mocker): @pytest.fixture(scope='function') -def mock_get_service_email_template(mocker, content=None, subject=None): +def mock_get_service_email_template(mocker, content=None, subject=None, redact_personalisation=False): def _get(service_id, template_id, version=None): template = template_json( service_id, @@ -360,6 +360,7 @@ def mock_get_service_email_template(mocker, content=None, subject=None): "email", content or "Your vehicle tax expires on ((date))", subject or "Your ((thing)) is due soon", + redact_personalisation=redact_personalisation, ) return {'data': template}