From 60a3ad72f98ae4498b1648ddf4f864960c3c32ee Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 18 Oct 2017 11:36:26 +0100 Subject: [PATCH] =?UTF-8?q?Hide=20=E2=80=98delete=E2=80=99=20link=20if=20t?= =?UTF-8?q?emplate=E2=80=99s=20already=20deleted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/views/templates/template.html | 10 ++++++---- tests/app/main/views/test_templates.py | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index 66142db28..80623185f 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -64,10 +64,12 @@
{% endif %} {% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %} - - Delete this template - -   + {% if not template._template.archived %} + + Delete this template + +   + {% endif %} {% 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 13f87c697..d6c258bdf 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -860,6 +860,7 @@ def test_should_show_page_for_a_deleted_template( assert url_for("main.edit_service_template", service_id=fake_uuid, template_id=fake_uuid) not in content assert url_for("main.send_test", service_id=fake_uuid, template_id=fake_uuid) not in content assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 3:00pm.' + assert 'Delete this template' not in page.select_one('main').text mock_get_deleted_template.assert_called_with(service_id, template_id)