From 9347c9a9795f0482f19f6d52ef4faa1bab80322e Mon Sep 17 00:00:00 2001 From: David McDonald Date: Wed, 30 Sep 2020 13:39:37 +0100 Subject: [PATCH] Redirect to the new check tour notification page After the steps have been completed, redirect them to the new check tour notification page to review their message --- app/main/views/tour.py | 19 ++++++++++++++----- app/navigation.py | 4 ++++ tests/app/main/views/test_tour.py | 10 ++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app/main/views/tour.py b/app/main/views/tour.py index de4ec63a7..136c421d0 100644 --- a/app/main/views/tour.py +++ b/app/main/views/tour.py @@ -6,7 +6,6 @@ from app.main.views.send import ( all_placeholders_in_session, fields_to_fill_in, get_normalised_placeholders_from_session, - get_notification_check_endpoint, get_placeholder_form_instance, get_recipient_and_placeholders_from_session, ) @@ -62,9 +61,11 @@ def tour_step(service_id, template_id, step_index): current_placeholder = placeholders[step_index - 1] except IndexError: if all_placeholders_in_session(placeholders): - return get_notification_check_endpoint(service_id, template) + return redirect(url_for( + '.check_tour_notification', service_id=current_service.id, template_id=template_id + )) return redirect(url_for( - '.tour_step', service_id=current_service.id, template_id=db_template['id'], step_index=1 + '.tour_step', service_id=current_service.id, template_id=template_id, step_index=1 )) form = get_placeholder_form_instance( @@ -78,9 +79,11 @@ def tour_step(service_id, template_id, step_index): session['placeholders'][current_placeholder] = form.placeholder_value.data if all_placeholders_in_session(placeholders): - return get_notification_check_endpoint(service_id, template) + return redirect(url_for( + '.check_tour_notification', service_id=current_service.id, template_id=template_id + )) return redirect(url_for( - '.tour_step', service_id=current_service.id, template_id=db_template['id'], step_index=step_index + 1 + '.tour_step', service_id=current_service.id, template_id=template_id, step_index=step_index + 1 )) back_link = _get_tour_step_back_link(service_id, template_id, step_index) @@ -103,3 +106,9 @@ def _get_tour_step_back_link(service_id, template_id, step_index): return url_for('.begin_tour', service_id=service_id, template_id=template_id) return url_for('.tour_step', service_id=service_id, template_id=template_id, step_index=step_index - 1) + + +@main.route("/services//tour//check", methods=['GET']) +@user_has_permissions('send_messages', restrict_admin_usage=True) +def check_tour_notification(service_id, template_id): + pass diff --git a/app/navigation.py b/app/navigation.py index 282c0ba5f..c0e23f65a 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -154,6 +154,7 @@ class HeaderNavigation(Navigation): 'no_cookie.check_messages_preview', 'check_notification', 'no_cookie.check_notification_preview', + 'check_tour_notification', 'choose_account', 'choose_from_contact_list', 'choose_service', @@ -540,6 +541,7 @@ class MainNavigation(Navigation): 'check_and_resend_verification_code', 'no_cookie.check_messages_preview', 'no_cookie.check_notification_preview', + 'check_tour_notification', 'choose_account', 'choose_service', 'clear_cache', @@ -780,6 +782,7 @@ class CaseworkNavigation(Navigation): 'no_cookie.check_messages_preview', 'check_notification', 'no_cookie.check_notification_preview', + 'check_tour_notification', 'choose_account', 'choose_service', 'choose_template_to_copy', @@ -1108,6 +1111,7 @@ class OrgNavigation(Navigation): 'no_cookie.check_messages_preview', 'check_notification', 'no_cookie.check_notification_preview', + 'check_tour_notification', 'choose_account', 'choose_from_contact_list', 'choose_service', diff --git a/tests/app/main/views/test_tour.py b/tests/app/main/views/test_tour.py index 18cea1813..d9871e74f 100644 --- a/tests/app/main/views/test_tour.py +++ b/tests/app/main/views/test_tour.py @@ -398,12 +398,11 @@ def test_post_final_tour_step_saves_data_and_redirects_to_check_notification( _data={'placeholder_value': 'howdy'}, _expected_status=302, _expected_redirect=url_for( - 'main.check_notification', + 'main.check_tour_notification', service_id=SERVICE_ONE_ID, template_id=fake_uuid, - help=None, _external=True - ), # this location needs to change + ), ) with client_request.session_transaction() as session: @@ -451,10 +450,9 @@ def test_get_test_step_out_of_index_redirects_to_check_notification_if_all_place step_index=4, _expected_status=302, _expected_redirect=url_for( - 'main.check_notification', + 'main.check_tour_notification', service_id=SERVICE_ONE_ID, template_id=fake_uuid, - help=None, _external=True - ), # this location needs to change + ), )