mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Split support into two pages
The kind of communications we’re getting at the moment can broadly be broken down into: - problems - questions and feedback We will need to triage problems differently, because they could potentially be urgent/severe/emergency/P1/whatever language we use. Questions or feedback will never be P1. Two reasons for making the user categorise their tickets themselves: - Outside of hours we can’t get someone out of bed in order to decide if a ticket is a problem or just feedback - We can tailor the subsequent pages to whether it’s a problem or feedback (eg showing a link to the status page if the user is having a problem) This commit let’s users make the choice with a pair of radio buttons. It also cleans up a bunch of the tests and parameterizes them so we’re testing the flow for both ticket types.
This commit is contained in:
@@ -392,10 +392,21 @@ class CreateKeyForm(Form):
|
||||
raise ValidationError('A key with this name already exists')
|
||||
|
||||
|
||||
class SupportType(Form):
|
||||
support_type = RadioField(
|
||||
'How can we help you?',
|
||||
choices=[
|
||||
('problem', 'Report a problem'),
|
||||
('question', 'Ask a question or give feedback'),
|
||||
],
|
||||
validators=[DataRequired()]
|
||||
)
|
||||
|
||||
|
||||
class Feedback(Form):
|
||||
name = StringField('Name')
|
||||
email_address = StringField('Email address')
|
||||
feedback = TextAreaField(u'', validators=[DataRequired(message="Can’t be empty")])
|
||||
feedback = TextAreaField('Your message', validators=[DataRequired(message="Can’t be empty")])
|
||||
|
||||
|
||||
class RequestToGoLiveForm(Form):
|
||||
|
||||
@@ -35,7 +35,7 @@ class ValidGovEmail(object):
|
||||
message = (
|
||||
'Enter a central government email address.'
|
||||
' If you think you should have access'
|
||||
' <a href="{}">contact us</a>').format(url_for('main.feedback'))
|
||||
' <a href="{}">contact us</a>').format(url_for('main.support'))
|
||||
if not is_gov_user(field.data.lower()):
|
||||
raise ValidationError(message)
|
||||
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
import requests
|
||||
from flask import render_template, url_for, redirect, flash, current_app, abort
|
||||
from app.main import main
|
||||
from app.main.forms import Feedback
|
||||
from app.main.forms import SupportType, Feedback
|
||||
|
||||
|
||||
@main.route('/support', methods=['GET', 'POST'])
|
||||
def support():
|
||||
return render_template('views/support/index.html')
|
||||
form = SupportType()
|
||||
if form.validate_on_submit():
|
||||
return redirect(url_for(
|
||||
'.feedback',
|
||||
ticket_type=form.support_type.data,
|
||||
))
|
||||
return render_template('views/support/index.html', form=form)
|
||||
|
||||
|
||||
@main.route('/support/feedback', methods=['GET', 'POST'])
|
||||
def feedback():
|
||||
@main.route('/support/contact/<ticket_type>', methods=['GET', 'POST'])
|
||||
def feedback(ticket_type):
|
||||
if ticket_type not in ['problem', 'question']:
|
||||
abort(404)
|
||||
form = Feedback()
|
||||
if form.validate_on_submit():
|
||||
user_supplied_email = form.email_address.data != ''
|
||||
@@ -25,7 +33,8 @@ def feedback():
|
||||
'department_id': current_app.config.get('DESKPRO_DEPT_ID'),
|
||||
'agent_team_id': current_app.config.get('DESKPRO_ASSIGNED_AGENT_TEAM_ID'),
|
||||
'subject': 'Notify feedback',
|
||||
'message': feedback_msg
|
||||
'message': feedback_msg,
|
||||
'label': ticket_type,
|
||||
}
|
||||
headers = {
|
||||
"X-DeskPRO-API-Key": current_app.config.get('DESKPRO_API_KEY'),
|
||||
@@ -43,6 +52,10 @@ def feedback():
|
||||
)
|
||||
abort(500, "Feedback submission failed")
|
||||
flash("Thanks, we’ve received your feedback", 'default_with_tick')
|
||||
return redirect(url_for('.support'))
|
||||
return redirect(url_for('.support', ticket_type=ticket_type))
|
||||
|
||||
return render_template('views/support/feedback.html', form=form)
|
||||
return render_template(
|
||||
'views/support/{}.html'.format(ticket_type),
|
||||
form=form,
|
||||
ticket_type=ticket_type
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user