diff --git a/app/main/forms.py b/app/main/forms.py
index 34e7c2918..c0e9e1b24 100644
--- a/app/main/forms.py
+++ b/app/main/forms.py
@@ -892,6 +892,17 @@ class SupportType(StripWhitespaceForm):
)
+class SupportRedirect(StripWhitespaceForm):
+ who = RadioField(
+ 'What do you need help with?',
+ choices=[
+ ('public-sector', 'I work in the public sector and need to send emails, text messages or letters'),
+ ('public', 'I’m a member of the public with a question for the government'),
+ ],
+ validators=[DataRequired()]
+ )
+
+
class Feedback(StripWhitespaceForm):
name = StringField('Name (optional)')
email_address = email_address(label='Email address', gov_user=False, required=True)
diff --git a/app/main/views/feedback.py b/app/main/views/feedback.py
index 9cf0cd6a5..0f386d2b6 100644
--- a/app/main/views/feedback.py
+++ b/app/main/views/feedback.py
@@ -7,7 +7,13 @@ from flask_login import current_user
from app import convert_to_boolean, current_service, service_api_client
from app.extensions import zendesk_client
from app.main import main
-from app.main.forms import Feedback, Problem, SupportType, Triage
+from app.main.forms import (
+ Feedback,
+ Problem,
+ SupportRedirect,
+ SupportType,
+ Triage,
+)
QUESTION_TICKET_TYPE = 'ask-question-give-feedback'
PROBLEM_TICKET_TYPE = "report-problem"
@@ -29,15 +35,35 @@ def get_prefilled_message():
@main.route('/support', methods=['GET', 'POST'])
def support():
- form = SupportType()
- if form.validate_on_submit():
- return redirect(url_for(
- '.feedback',
- ticket_type=form.support_type.data,
- ))
+
+ if current_user.is_authenticated:
+ form = SupportType()
+ if form.validate_on_submit():
+ return redirect(url_for(
+ '.feedback',
+ ticket_type=form.support_type.data,
+ ))
+ else:
+ form = SupportRedirect()
+ if form.validate_on_submit():
+ if form.who.data == 'public':
+ return redirect(url_for(
+ '.support_public'
+ ))
+ else:
+ return redirect(url_for(
+ '.feedback',
+ ticket_type=QUESTION_TICKET_TYPE,
+ ))
+
return render_template('views/support/index.html', form=form)
+@main.route('/support/public')
+def support_public():
+ return render_template('views/support/public.html')
+
+
@main.route('/support/triage', methods=['GET', 'POST'])
def triage():
form = Triage()
diff --git a/app/navigation.py b/app/navigation.py
index 2342429a2..53f01483c 100644
--- a/app/navigation.py
+++ b/app/navigation.py
@@ -47,6 +47,7 @@ class HeaderNavigation(Navigation):
'bat_phone',
'feedback',
'support',
+ 'support_public',
'thanks',
'triage',
},
@@ -619,6 +620,7 @@ class MainNavigation(Navigation):
'start_tour',
'styleguide',
'support',
+ 'support_public',
'suspend_service',
'template_history',
'terms',
@@ -916,6 +918,7 @@ class CaseworkNavigation(Navigation):
'styleguide',
'submit_request_to_go_live',
'support',
+ 'support_public',
'suspend_service',
'template_history',
'template_usage',
@@ -1209,6 +1212,7 @@ class OrgNavigation(Navigation):
'styleguide',
'submit_request_to_go_live',
'support',
+ 'support_public',
'suspend_service',
'template_history',
'template_usage',
diff --git a/app/templates/views/support/index.html b/app/templates/views/support/index.html
index fcf32bf7e..09dd8caba 100644
--- a/app/templates/views/support/index.html
+++ b/app/templates/views/support/index.html
@@ -9,19 +9,25 @@
{% block maincolumn_content %}
+
Support
+ We provide 24-hour online support for teams with a live service on GOV.UK Notify.
+
+ {% call form_wrapper() %}
+ {% if current_user.is_authenticated %}
+ {{ radios(form.support_type) }}
+ {% else %}
+
+ What do you need help with?
+
+ {{ radios(form.who, hide_legend=True) }}
+ {% endif %}
+ {{ page_footer('Continue') }}
+ {% endcall %}
+
+ You can also contact us on Slack.
+
-
-
Support
-
We provide 24-hour online support for teams with a live service on GOV.UK Notify.
-
- {% call form_wrapper(class="bottom-gutter-2") %}
- {{ radios(form.support_type) }}
- {{ page_footer('Continue') }}
- {% endcall %}
-
-
You can also contact us on Slack.
-
Office hours
Our office hours are 9:30am to 5:30pm, Monday to Friday.
When you report a problem in office hours, we’ll aim to read it within 30 minutes and reply within one working day.
diff --git a/app/templates/views/support/public.html b/app/templates/views/support/public.html
new file mode 100644
index 000000000..711a08ccb
--- /dev/null
+++ b/app/templates/views/support/public.html
@@ -0,0 +1,48 @@
+{% extends "withoutnav_template.html" %}
+
+{% from "components/page-header.html" import page_header %}
+
+{% block per_page_title %}
+ The GOV.UK Notify team can’t give advice to members of the public
+{% endblock %}
+
+{% block maincolumn_content %}
+
+
+
+
+ {{ page_header(
+ 'The GOV.UK Notify service is for people who work in the government',
+ back_link=url_for('.support')
+ ) }}
+
+
+ We can’t give advice to the public. We don’t have access to information about you held by government departments.
+
+
+
+ There are other pages on GOV.UK where you can get help:
+
+
+
+
+ What you need to do
+
+
+
+ Ask about benefits, driving, transport, tax, and more
+
+
+
+ Advice on suspicious emails and text messages
+
+
+
+
+{% endblock %}
diff --git a/tests/app/main/views/test_feedback.py b/tests/app/main/views/test_feedback.py
index 684fc2b12..0a2cd3a58 100644
--- a/tests/app/main/views/test_feedback.py
+++ b/tests/app/main/views/test_feedback.py
@@ -19,18 +19,48 @@ def no_redirect():
return lambda _external=True: None
-@pytest.mark.parametrize('endpoint', [
- 'main.old_feedback',
- 'main.support',
-])
def test_get_support_index_page(
- client,
- endpoint,
+ client_request,
):
- response = client.get(url_for('main.support'), follow_redirects=True)
- assert response.status_code == 200
- page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
- assert page.h1.string.strip() == 'Support'
+ page = client_request.get('.support')
+ assert page.select_one('form')['method'] == 'post'
+ assert 'action' not in page.select_one('form')
+ assert normalize_spaces(page.select_one('h1').text) == 'Support'
+ assert normalize_spaces(
+ page.select_one('form label[for=support_type-0]').text
+ ) == 'Report a problem'
+ assert page.select_one('form input#support_type-0')['value'] == 'report-problem'
+ assert normalize_spaces(
+ page.select_one('form label[for=support_type-1]').text
+ ) == 'Ask a question or give feedback'
+ assert page.select_one('form input#support_type-1')['value'] == 'ask-question-give-feedback'
+ assert normalize_spaces(
+ page.select_one('form button[type=submit]').text
+ ) == 'Continue'
+
+
+def test_get_support_index_page_when_signed_out(
+ client_request,
+):
+ client_request.logout()
+ page = client_request.get('.support')
+ assert page.select_one('form')['method'] == 'post'
+ assert 'action' not in page.select_one('form')
+ assert normalize_spaces(
+ page.select_one('form label[for=who-0]').text
+ ) == (
+ 'I work in the public sector and need to send emails, text messages or letters'
+ )
+ assert page.select_one('form input#who-0')['value'] == 'public-sector'
+ assert normalize_spaces(
+ page.select_one('form label[for=who-1]').text
+ ) == (
+ 'I’m a member of the public with a question for the government'
+ )
+ assert page.select_one('form input#who-1')['value'] == 'public'
+ assert normalize_spaces(
+ page.select_one('form button[type=submit]').text
+ ) == 'Continue'
@freeze_time('2016-12-12 12:00:00.000000')
@@ -38,34 +68,58 @@ def test_get_support_index_page(
(PROBLEM_TICKET_TYPE, 'Report a problem'),
(QUESTION_TICKET_TYPE, 'Ask a question or give feedback'),
])
-@pytest.mark.parametrize('logged_in, expected_form_field, expected_contact_details', [
- (True, type(None), 'We’ll reply to test@user.gov.uk'),
- (False, element.Tag, None),
-])
def test_choose_support_type(
- client,
- api_user_active,
- mock_get_user,
- mock_get_services,
- logged_in,
- expected_form_field,
- expected_contact_details,
+ client_request,
support_type,
expected_h1
):
- if logged_in:
- client.login(api_user_active)
- response = client.post(
- url_for('main.support'),
- data={'support_type': support_type}, follow_redirects=True
+ page = client_request.post(
+ 'main.support',
+ _data={'support_type': support_type},
+ _follow_redirects=True,
)
- assert response.status_code == 200
- page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.h1.string.strip() == expected_h1
- assert isinstance(page.find('input', {'name': 'name'}), expected_form_field)
- assert isinstance(page.find('input', {'name': 'email_address'}), expected_form_field)
- if expected_contact_details:
- assert page.find('form').find('p').text.strip() == expected_contact_details
+ assert not page.select_one('input[name=name]')
+ assert not page.select_one('input[name=email_address]')
+ assert page.find('form').find('p').text.strip() == (
+ 'We’ll reply to test@user.gov.uk'
+ )
+
+
+def test_get_support_as_someone_in_the_public_sector(
+ client_request,
+):
+ client_request.logout()
+ page = client_request.post(
+ 'main.support',
+ _data={'who': 'public-sector'},
+ _follow_redirects=True,
+ )
+ assert normalize_spaces(page.select('h1')) == (
+ 'Ask a question or give feedback'
+ )
+ assert page.select_one('form textarea[name=feedback]')
+ assert page.select_one('form input[name=name]')
+ assert page.select_one('form input[name=email_address]')
+ assert page.select_one('form button[type=submit]')
+
+
+def test_get_support_as_member_of_public(
+ client_request,
+):
+ client_request.logout()
+ page = client_request.post(
+ 'main.support',
+ _data={'who': 'public'},
+ _follow_redirects=True,
+ )
+ assert normalize_spaces(page.select('h1')) == (
+ 'The GOV.UK Notify service is for people who work in the government'
+ )
+ assert len(page.select('h2 a')) == 3
+ assert not page.select('form')
+ assert not page.select('input')
+ assert not page.select('form [type=submit]')
@freeze_time('2016-12-12 12:00:00.000000')