From 17a7f5f2c6c1878db18d7ab1074e5acd7bc16f66 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 24 Jul 2017 14:55:39 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20last=20used=20message=20if=20key?= =?UTF-8?q?=E2=80=99s=20never=20been=20used?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don’t think it adds anything to tell you that a key’s never been used. The value of the ‘key was used 3 minutes ago’ message is in stopping you accidentally revoking something you shouldn’t have. --- app/main/views/templates.py | 2 +- app/templates/views/templates/template.html | 8 +++++--- tests/app/main/views/test_templates.py | 4 +--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 180c4fc5e..892f570d6 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -436,7 +436,7 @@ def delete_service_template(service_id, template_id): ) except HTTPError as e: if e.status_code == 404: - message = 'It’s never been used.'.format(template['name']) + message = None else: raise e diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index 95ea73c83..66142db28 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -30,9 +30,11 @@ {% elif template_delete_confirmation_message %}
{% call banner_wrapper(type='dangerous', subhead=template_delete_confirmation_message[0]) %} -

- {{ template_delete_confirmation_message[1] }} -

+ {% if template_delete_confirmation_message[1] %} +

+ {{ template_delete_confirmation_message[1] }} +

+ {% endif %}
diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 5c8fe8b44..e2cb7aaa3 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -725,9 +725,7 @@ def test_should_show_delete_template_page_with_never_used_block( _test_page_title=False, ) assert page.h1.text == 'Are you sure you want to delete Two week reminder?' - assert normalize_spaces(page.select('.banner-dangerous p')[0].text) == ( - 'It’s never been used.' - ) + assert not page.select('.banner-dangerous p') assert normalize_spaces(page.select('.sms-message-wrapper')[0].text) == ( 'service one: Template content with & entity' )