Require email address for all support tickets

We are seeing little benefit of allowing users to not put in their email
address. This will mean that you must provide it for feedback, not just
problems with the site.

There could maybe be some more refactoring of the support templates as
this is now very similar to the report a problem page but this is a
quick fix so haven't gone too in depth.
This commit is contained in:
David McDonald
2020-03-23 11:04:03 +00:00
parent 60626dfb55
commit d7385da0df
3 changed files with 7 additions and 29 deletions

View File

@@ -894,7 +894,7 @@ class SupportType(StripWhitespaceForm):
class Feedback(StripWhitespaceForm):
name = StringField('Name')
email_address = email_address(label='Email address', gov_user=False, required=False)
email_address = email_address(label='Email address', gov_user=False, required=True)
feedback = TextAreaField('Your message', validators=[DataRequired(message="Cannot be empty")])

View File

@@ -19,8 +19,6 @@
{% call form_wrapper() %}
{{ textbox(form.feedback, width='1-1', hint='', rows=10, autosize=True) }}
{% if not current_user.is_authenticated %}
<h3 class="heading-medium">Do you want a reply?</h3>
<p>Leave your details below if youd like a response.</p>
{{ textbox(form.name, width='1-1') }}
{{ textbox(form.email_address, width='1-1') }}
{% else %}

View File

@@ -204,34 +204,15 @@ def test_passes_user_details_through_flow(
{'feedback': 'blah', 'name': 'Fred'},
{'feedback': 'blah'},
])
@pytest.mark.parametrize('ticket_type, expected_response, expected_redirect, expected_error', [
(
PROBLEM_TICKET_TYPE,
200,
lambda: None,
element.Tag,
),
(
QUESTION_TICKET_TYPE,
302,
partial(
url_for,
'.thanks',
email_address_provided=False,
out_of_hours_emergency=False,
_external=True,
),
type(None),
),
@pytest.mark.parametrize('ticket_type', [
PROBLEM_TICKET_TYPE,
QUESTION_TICKET_TYPE,
])
def test_email_address_required_for_problems(
def test_email_address_required_for_problems_and_questions(
client_request,
mocker,
data,
ticket_type,
expected_response,
expected_redirect,
expected_error
):
mocker.patch('app.main.views.feedback.zendesk_client')
client_request.logout()
@@ -239,10 +220,9 @@ def test_email_address_required_for_problems(
'main.feedback',
ticket_type=ticket_type,
_data=data,
_expected_status=expected_response,
_expected_redirect=expected_redirect(),
_expected_status=200
)
assert isinstance(page.find('span', {'class': 'error-message'}), expected_error)
assert isinstance(page.find('span', {'class': 'error-message'}), element.Tag)
@freeze_time('2016-12-12 12:00:00.000000')