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
This commit is contained in:
David McDonald
2020-09-30 13:39:37 +01:00
parent c2a691e6d9
commit 9347c9a979
3 changed files with 22 additions and 11 deletions

View File

@@ -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/<uuid:service_id>/tour/<uuid:template_id>/check", methods=['GET'])
@user_has_permissions('send_messages', restrict_admin_usage=True)
def check_tour_notification(service_id, template_id):
pass

View File

@@ -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',

View File

@@ -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
),
)