From dbc85fcc1fd12eada42e2f9c9008770810f43553 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 12 Nov 2019 16:57:01 +0000 Subject: [PATCH] Only show breaking change page to API users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We introduced the ‘breaking change’ page[1] partly to help teach people about the relationship between the placeholders in their template and the data they were providing. Data can be provided either by API or by uploading a spreadsheet. The users who we struggled to communicate this relationship to were the ones using the upload a spreadsheet feature. We made two changes to the context of this feature: 1. Around the same time we introduced the interactive tour[2], which ultimately proved to be the thing that helped people understand the relationship between the data they were providing and the placeholders in the template. 2. We introduced a way for people to send one-off messages without using the API or uploading a spreadsheet[3]. So for this page to say that you’ll need to update a spreadsheet or change an API call if you change the placeholders in your template is no longer accurate. Therefore I think it makes sense to only show this page to teams who are using the API to send messages. The best proxy we have for that is to look at whether they’ve created any API keys. *** 1. https://github.com/alphagov/notifications-admin/pull/631 2. https://github.com/alphagov/notifications-admin/pull/613 3. https://github.com/alphagov/notifications-admin/pull/1293 --- app/main/views/templates.py | 7 ++++++- tests/app/main/views/test_templates.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 381117f9d..b6b1fb2c7 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -603,7 +603,12 @@ def edit_service_template(service_id, template_id): new_template = get_template(new_template_data, current_service) template_change = get_template(template, current_service).compare_to(new_template) - if template_change.placeholders_added and not request.form.get('confirm'): + + if ( + template_change.placeholders_added and + not request.form.get('confirm') and + current_service.api_keys + ): example_column_headings = ( first_column_headings[new_template.template_type] + list(new_template.placeholders) ) diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 90f4cdfd0..9c6ac9968 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -1328,6 +1328,7 @@ def test_should_redirect_to_one_off_if_template_type_is_letter( def test_should_redirect_when_saving_a_template( client_request, mock_get_service_template, + mock_get_api_keys, mock_update_service_template, fake_uuid, ): @@ -1499,6 +1500,7 @@ def test_should_show_interstitial_when_making_breaking_change( client_request, mock_update_service_template, mock_get_user_by_email, + mock_get_api_keys, fake_uuid, mocker, template_mock,