Remove old tour and help arguments from sending flow

We no longer need the `start_tour` page as this has been replaced with
the new `begin_tour` page.

We also no longer need to handle the `help` argument in the
`send_test_step` or `send_one_off_step` as these no longer are
responsible for the tour and don't need to show the help text.

Worth pointing out, the new tour joins into the send one off flow. When
doing a GET `check_tour_notification`, and submitting the form shown on
this page you are POSTed to `send_notification` with `help=3`. Also for
general sending of one off notifications, the POST to
`send_notification` is done with `help=0` which is a bit of a hack to
make sure that we don't show a back link on the `view_notification` page
for when someone gets there having just sent a one off notification.
This use of `help=0` may be a candidate for a refactor in the future as
it feels like a bit of a hacky way of doing things and is therefore not
as clear to developers what is going on.

Also removes the help argument from the csv routes used here. There is
no reason that we need to ever show help for CSVs and this is leftover
code from when we used to do the tour that way.
This commit is contained in:
David McDonald
2020-10-05 11:55:15 +01:00
parent 1b310a0f8a
commit 389638244c
7 changed files with 17 additions and 272 deletions

View File

@@ -54,7 +54,6 @@ from app.utils import (
PermanentRedirect,
Spreadsheet,
get_errors_for_csv,
get_help_argument,
get_template,
should_skip_template_page,
unicode_truncate,
@@ -321,7 +320,6 @@ def send_test(service_id, template_id):
service_id=service_id,
template_id=template_id,
step_index=0,
help=get_help_argument(),
))
@@ -330,8 +328,6 @@ def get_notification_check_endpoint(service_id, template):
'main.check_notification',
service_id=service_id,
template_id=template.id,
# at check phase we should move to help stage 2 ("the template pulls in the data you provide")
help='2' if 'help' in request.args else None
))
@@ -394,14 +390,12 @@ def send_one_off_letter_address(service_id, template_id):
'views/send-one-off-letter-address.html',
page_title=get_send_test_page_title(
template_type='letter',
help_argument=None,
entering_recipient=True,
name=template.name,
),
template=template,
form=form,
back_link=get_back_link(service_id, template, 0),
help=False,
link_to_upload=True,
)
@@ -487,7 +481,6 @@ def send_test_step(service_id, template_id, step_index):
service_id=service_id,
template_id=template_id,
step_index=step_index + 1,
help=get_help_argument(),
))
form = get_placeholder_form_instance(
@@ -518,7 +511,6 @@ def send_test_step(service_id, template_id, step_index):
service_id=service_id,
template_id=template_id,
step_index=step_index + 1,
help=get_help_argument(),
))
back_link = get_back_link(service_id, template, step_index, placeholders)
@@ -530,7 +522,6 @@ def send_test_step(service_id, template_id, step_index):
'views/send-test.html',
page_title=get_send_test_page_title(
template.template_type,
get_help_argument(),
entering_recipient=not session['recipient'],
name=template.name,
),
@@ -538,7 +529,6 @@ def send_test_step(service_id, template_id, step_index):
form=form,
skip_link=get_skip_link(step_index, template),
back_link=back_link,
help=get_help_argument(),
link_to_upload=(
request.endpoint == 'main.send_one_off_step'
and step_index == 0
@@ -707,7 +697,6 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
remaining_messages=remaining_messages,
choose_time_form=choose_time_form,
back_link=back_link,
help=get_help_argument(),
trying_to_send_letters_in_trial_mode=all((
current_service.trial_mode,
template.template_type == 'letter',
@@ -834,7 +823,6 @@ def start_job(service_id, upload_id):
'main.view_job',
job_id=upload_id,
service_id=service_id,
help=request.form.get('help'),
just_sent='yes',
)
)
@@ -891,9 +879,7 @@ def all_placeholders_in_session(placeholders):
)
def get_send_test_page_title(template_type, help_argument, entering_recipient, name=None):
if help_argument:
return 'Example text message'
def get_send_test_page_title(template_type, entering_recipient, name=None):
if entering_recipient:
return 'Send {}'.format(name)
return 'Personalise this message'
@@ -908,31 +894,7 @@ def is_current_user_the_recipient():
def get_back_link(service_id, template, step_index, placeholders=None):
if get_help_argument():
# if we're on the check page, redirect back to the beginning. anywhere else, don't return the back link
if request.endpoint == 'main.check_notification':
return url_for(
'main.send_test',
service_id=service_id,
template_id=template.id,
help=get_help_argument()
)
else:
if step_index == 0:
return url_for(
'main.start_tour',
service_id=service_id,
template_id=template.id,
)
elif step_index > 0:
return url_for(
'main.send_test_step',
service_id=service_id,
template_id=template.id,
step_index=step_index - 1,
help=2,
)
elif step_index == 0:
if step_index == 0:
if should_skip_template_page(template.template_type):
return url_for(
'.choose_template',
@@ -1046,7 +1008,6 @@ def _check_notification(service_id, template_id, exception=None):
return dict(
template=template,
back_link=back_link,
help=get_help_argument(),
letter_too_long=is_letter_too_long(page_count),
letter_max_pages=LETTER_MAX_PAGE_COUNT,
page_count=page_count,
@@ -1116,6 +1077,8 @@ def send_notification(service_id, template_id):
'.view_notification',
service_id=service_id,
notification_id=noti['id'],
# used to show the final step of the tour (help=3) or not show
# a back link on a just sent one off notification (help=0)
help=request.args.get('help')
))

View File

@@ -83,27 +83,6 @@ def view_template(service_id, template_id):
)
@main.route("/services/<uuid:service_id>/start-tour/<uuid:template_id>")
@user_has_permissions('view_activity')
def start_tour(service_id, template_id):
template = current_service.get_template(template_id)
if template['template_type'] != 'sms':
abort(404)
return render_template(
'views/templates/start-tour.html',
template=get_template(
template,
current_service,
show_recipient=True,
),
help='1',
continue_link=url_for('.send_test', service_id=current_service.id, template_id=template['id'], help=2)
)
@main.route("/services/<uuid:service_id>/templates/all", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates/folders/<uuid:template_folder_id>", methods=['GET', 'POST'])

View File

@@ -322,7 +322,6 @@ class HeaderNavigation(Navigation):
'show_accounts_or_dashboard',
'sign_out',
'start_job',
'start_tour',
'styleguide',
'submit_request_to_go_live',
'template_history',
@@ -665,7 +664,6 @@ class MainNavigation(Navigation):
'sign_in',
'sign_out',
'start_job',
'start_tour',
'styleguide',
'support',
'support_public',
@@ -978,7 +976,6 @@ class CaseworkNavigation(Navigation):
'sign_in',
'sign_out',
'start_job',
'start_tour',
'styleguide',
'submit_request_to_go_live',
'support',
@@ -1293,7 +1290,6 @@ class OrgNavigation(Navigation):
'sign_in',
'sign_out',
'start_job',
'start_tour',
'styleguide',
'submit_request_to_go_live',
'support',

View File

@@ -35,7 +35,6 @@
<div class="bottom-gutter-3-2">
<form method="post" enctype="multipart/form-data" action="{{url_for('main.start_job', service_id=current_service.id, upload_id=upload_id, original_file_name=original_file_name)}}" class='page-footer'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="help" value="{{ '3' if help else 0 }}" />
<input type="hidden" name="contact_list_id" value="{{ request.args.get('contact_list_id', '') }}" />
{% if choose_time_form and template.template_type != 'letter' %}
{{ radio_select(