mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 09:13:58 -04:00
Make ‘thanks’ page consistent with support page
On the support page we now promise that we’ll: - look at tickets within half an hour - reply within one working day The thanks page was always promising a reply within half an hour, during business hours or an emergency. This commit changes the ‘thanks’ page to be consistent with the support page.
This commit is contained in:
@@ -71,21 +71,11 @@ def feedback(ticket_type):
|
|||||||
else:
|
else:
|
||||||
severe = None
|
severe = None
|
||||||
|
|
||||||
p1 = False
|
out_of_hours_emergency = all((
|
||||||
urgent = False
|
ticket_type == PROBLEM_TICKET_TYPE,
|
||||||
|
not in_business_hours(),
|
||||||
if in_business_hours():
|
severe,
|
||||||
# if we're in the office, it's urgent (aka we'll get back in 30 mins)
|
))
|
||||||
urgent = True
|
|
||||||
elif ticket_type == PROBLEM_TICKET_TYPE and severe:
|
|
||||||
# out of hours, it's only a p1 and it's only urgent if it's a p1
|
|
||||||
urgent = True
|
|
||||||
p1 = True
|
|
||||||
|
|
||||||
anonymous = (
|
|
||||||
(not form.email_address.data) and
|
|
||||||
(not current_user.is_authenticated)
|
|
||||||
)
|
|
||||||
|
|
||||||
if needs_triage(ticket_type, severe):
|
if needs_triage(ticket_type, severe):
|
||||||
session['feedback_message'] = form.feedback.data
|
session['feedback_message'] = form.feedback.data
|
||||||
@@ -119,11 +109,17 @@ def feedback(ticket_type):
|
|||||||
subject='Notify feedback',
|
subject='Notify feedback',
|
||||||
message=feedback_msg,
|
message=feedback_msg,
|
||||||
ticket_type=ticket_type,
|
ticket_type=ticket_type,
|
||||||
p1=p1,
|
p1=out_of_hours_emergency,
|
||||||
user_email=user_email,
|
user_email=user_email,
|
||||||
user_name=user_name
|
user_name=user_name
|
||||||
)
|
)
|
||||||
return redirect(url_for('.thanks', urgent=urgent, anonymous=anonymous))
|
return redirect(url_for(
|
||||||
|
'.thanks',
|
||||||
|
out_of_hours_emergency=out_of_hours_emergency,
|
||||||
|
email_address_provided=(
|
||||||
|
current_user.is_authenticated or bool(form.email_address.data)
|
||||||
|
),
|
||||||
|
))
|
||||||
|
|
||||||
if not form.feedback.data:
|
if not form.feedback.data:
|
||||||
form.feedback.data = get_prefilled_message()
|
form.feedback.data = get_prefilled_message()
|
||||||
@@ -148,9 +144,9 @@ def bat_phone():
|
|||||||
def thanks():
|
def thanks():
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/support/thanks.html',
|
'views/support/thanks.html',
|
||||||
urgent=convert_to_boolean(request.args.get('urgent')),
|
out_of_hours_emergency=convert_to_boolean(request.args.get('out_of_hours_emergency')),
|
||||||
anonymous=convert_to_boolean(request.args.get('anonymous')),
|
email_address_provided=convert_to_boolean(request.args.get('email_address_provided')),
|
||||||
logged_in=current_user.is_authenticated,
|
out_of_hours=not in_business_hours(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,19 +9,26 @@
|
|||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
|
||||||
<h1 class="heading-large">
|
<h1 class="heading-large">
|
||||||
Thanks for contacting GOV.UK Notify
|
Thanks for contacting us
|
||||||
</h1>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
{% if anonymous %}
|
{% if out_of_hours_emergency %}
|
||||||
We’ll look into it
|
We’ll reply in the next 30 minutes.
|
||||||
{% else %}
|
{% else %}
|
||||||
We’ll get back to you
|
{% if email_address_provided %}
|
||||||
{% endif %}
|
{% if out_of_hours %}
|
||||||
|
We’ll reply within one working day.
|
||||||
{% if urgent %}
|
{% else %}
|
||||||
within 30 minutes.
|
We’ll read it in the next 30 minutes and reply within one
|
||||||
{% else %}
|
working day.
|
||||||
by the next working day.
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if out_of_hours %}
|
||||||
|
We’ll read it when we’re back in the office.
|
||||||
|
{% else %}
|
||||||
|
We’ll read it in the next 30 minutes.
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -142,7 +142,12 @@ def test_passed_non_logged_in_user_details_through_flow(client, mocker, ticket_t
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert resp.status_code == 302
|
assert resp.status_code == 302
|
||||||
assert resp.location == url_for('main.thanks', urgent=True, anonymous=False, _external=True)
|
assert resp.location == url_for(
|
||||||
|
'main.thanks',
|
||||||
|
out_of_hours_emergency=False,
|
||||||
|
email_address_provided=True,
|
||||||
|
_external=True,
|
||||||
|
)
|
||||||
mock_post.assert_called_with(
|
mock_post.assert_called_with(
|
||||||
subject='Notify feedback',
|
subject='Notify feedback',
|
||||||
message='blah\n',
|
message='blah\n',
|
||||||
@@ -174,8 +179,8 @@ def test_passes_user_details_through_flow(
|
|||||||
_expected_status=302,
|
_expected_status=302,
|
||||||
_expected_redirect=url_for(
|
_expected_redirect=url_for(
|
||||||
'main.thanks',
|
'main.thanks',
|
||||||
urgent=True,
|
email_address_provided=True,
|
||||||
anonymous=False,
|
out_of_hours_emergency=False,
|
||||||
_external=True,
|
_external=True,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -207,7 +212,7 @@ def test_passes_user_details_through_flow(
|
|||||||
])
|
])
|
||||||
@pytest.mark.parametrize('ticket_type, expected_response, things_expected_in_url, expected_error', [
|
@pytest.mark.parametrize('ticket_type, expected_response, things_expected_in_url, expected_error', [
|
||||||
(PROBLEM_TICKET_TYPE, 200, [], element.Tag),
|
(PROBLEM_TICKET_TYPE, 200, [], element.Tag),
|
||||||
(QUESTION_TICKET_TYPE, 302, ['thanks', 'anonymous=True', 'urgent=True'], type(None)),
|
(QUESTION_TICKET_TYPE, 302, ['thanks', 'email_address_provided=False', 'out_of_hours_emergency=False'], type(None)),
|
||||||
])
|
])
|
||||||
def test_email_address_required_for_problems(
|
def test_email_address_required_for_problems(
|
||||||
client,
|
client,
|
||||||
@@ -255,21 +260,21 @@ def test_email_address_must_be_valid_if_provided_to_support_form(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('ticket_type, severe, is_in_business_hours, is_urgent, is_p1', [
|
@pytest.mark.parametrize('ticket_type, severe, is_in_business_hours, is_out_of_hours_emergency', [
|
||||||
|
|
||||||
# business hours, always urgent, never p1
|
# business hours, never an emergency
|
||||||
(PROBLEM_TICKET_TYPE, 'yes', True, True, False),
|
(PROBLEM_TICKET_TYPE, 'yes', True, False),
|
||||||
(QUESTION_TICKET_TYPE, 'yes', True, True, False),
|
(QUESTION_TICKET_TYPE, 'yes', True, False),
|
||||||
(PROBLEM_TICKET_TYPE, 'no', True, True, False),
|
(PROBLEM_TICKET_TYPE, 'no', True, False),
|
||||||
(QUESTION_TICKET_TYPE, 'no', True, True, False),
|
(QUESTION_TICKET_TYPE, 'no', True, False),
|
||||||
|
|
||||||
# out of hours, non emergency, never urgent, not p1
|
# out of hours, if the user says it’s not an emergency
|
||||||
(PROBLEM_TICKET_TYPE, 'no', False, False, False),
|
(PROBLEM_TICKET_TYPE, 'no', False, False),
|
||||||
(QUESTION_TICKET_TYPE, 'no', False, False, False),
|
(QUESTION_TICKET_TYPE, 'no', False, False),
|
||||||
|
|
||||||
# out of hours, emergency problems are urgent and p1
|
# out of hours, only problems can be emergencies
|
||||||
(PROBLEM_TICKET_TYPE, 'yes', False, True, True),
|
(PROBLEM_TICKET_TYPE, 'yes', False, True),
|
||||||
(QUESTION_TICKET_TYPE, 'yes', False, False, False),
|
(QUESTION_TICKET_TYPE, 'yes', False, False),
|
||||||
|
|
||||||
])
|
])
|
||||||
def test_urgency(
|
def test_urgency(
|
||||||
@@ -278,8 +283,7 @@ def test_urgency(
|
|||||||
ticket_type,
|
ticket_type,
|
||||||
severe,
|
severe,
|
||||||
is_in_business_hours,
|
is_in_business_hours,
|
||||||
is_urgent,
|
is_out_of_hours_emergency,
|
||||||
is_p1,
|
|
||||||
):
|
):
|
||||||
mocker.patch('app.main.views.feedback.in_business_hours', return_value=is_in_business_hours)
|
mocker.patch('app.main.views.feedback.in_business_hours', return_value=is_in_business_hours)
|
||||||
mock_post = mocker.patch('app.main.views.feedback.zendesk_client.create_ticket')
|
mock_post = mocker.patch('app.main.views.feedback.zendesk_client.create_ticket')
|
||||||
@@ -291,12 +295,12 @@ def test_urgency(
|
|||||||
_expected_status=302,
|
_expected_status=302,
|
||||||
_expected_redirect=url_for(
|
_expected_redirect=url_for(
|
||||||
'main.thanks',
|
'main.thanks',
|
||||||
urgent=is_urgent,
|
out_of_hours_emergency=is_out_of_hours_emergency,
|
||||||
anonymous=False,
|
email_address_provided=True,
|
||||||
_external=True,
|
_external=True,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
assert mock_post.call_args[1]['p1'] == is_p1
|
assert mock_post.call_args[1]['p1'] == is_out_of_hours_emergency
|
||||||
|
|
||||||
|
|
||||||
ids, params = zip(*[
|
ids, params = zip(*[
|
||||||
@@ -532,29 +536,54 @@ def test_bat_email_page(
|
|||||||
assert logged_in_response.location == url_for('main.feedback', ticket_type=PROBLEM_TICKET_TYPE, _external=True)
|
assert logged_in_response.location == url_for('main.feedback', ticket_type=PROBLEM_TICKET_TYPE, _external=True)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('logged_in', [True, False])
|
@pytest.mark.parametrize('out_of_hours_emergency, email_address_provided, out_of_hours, message', (
|
||||||
@pytest.mark.parametrize('urgent, anonymous, message', [
|
|
||||||
|
|
||||||
(True, False, 'We’ll get back to you within 30 minutes.'),
|
# Out of hours emergencies trump everything else
|
||||||
(False, False, 'We’ll get back to you by the next working day.'),
|
(
|
||||||
|
True, True, True,
|
||||||
|
'We’ll reply in the next 30 minutes.',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
True, False, False, # Not a real scenario
|
||||||
|
'We’ll reply in the next 30 minutes.',
|
||||||
|
),
|
||||||
|
|
||||||
(True, True, 'We’ll look into it within 30 minutes.'),
|
# Anonymous tickets don’t promise a reply
|
||||||
(False, True, 'We’ll look into it by the next working day.'),
|
(
|
||||||
|
False, False, False,
|
||||||
|
'We’ll read it in the next 30 minutes.',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
False, False, True,
|
||||||
|
'We’ll read it when we’re back in the office.',
|
||||||
|
),
|
||||||
|
|
||||||
])
|
# When we look at your ticket depends on whether we’re in normal
|
||||||
|
# business hours
|
||||||
|
(
|
||||||
|
False, True, False,
|
||||||
|
'We’ll read it in the next 30 minutes and reply within one working day.',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
False, True, True,
|
||||||
|
'We’ll reply within one working day.'
|
||||||
|
),
|
||||||
|
|
||||||
|
))
|
||||||
def test_thanks(
|
def test_thanks(
|
||||||
client,
|
client_request,
|
||||||
mocker,
|
mocker,
|
||||||
api_user_active,
|
api_user_active,
|
||||||
mock_get_user,
|
mock_get_user,
|
||||||
urgent,
|
out_of_hours_emergency,
|
||||||
anonymous,
|
email_address_provided,
|
||||||
|
out_of_hours,
|
||||||
message,
|
message,
|
||||||
logged_in,
|
|
||||||
):
|
):
|
||||||
if logged_in:
|
mocker.patch('app.main.views.feedback.in_business_hours', return_value=(not out_of_hours))
|
||||||
client.login(api_user_active)
|
page = client_request.get(
|
||||||
response = client.get(url_for('main.thanks', urgent=urgent, anonymous=anonymous))
|
'main.thanks',
|
||||||
assert response.status_code == 200
|
out_of_hours_emergency=out_of_hours_emergency,
|
||||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
email_address_provided=email_address_provided,
|
||||||
assert ' '.join(page.find('main').find('p').text.split()) == message
|
)
|
||||||
|
assert normalize_spaces(page.find('main').find('p').text) == message
|
||||||
|
|||||||
Reference in New Issue
Block a user