Preserve message in session if we go out of hours

This is a real edge case, but it seems worth handling.

How you’d get to this case:
- it’s 5:29pm and you start to describe the problem you’re having
- it’s 5:31pm and you click ‘submit’
- you’re redirected to the triage page because we’re now out of hours
- you click ‘this is a serious problem’

What would be bad thing to happen:
- you’re back on the message page and all the stuff you’ve written is
  gone

What would be a good thing to happen:
- we save the message in a session so that you can check it again before
  sending it
This commit is contained in:
Chris Hill-Scott
2016-12-12 14:11:34 +00:00
parent 4ef087fb01
commit 8f3ba46b27
2 changed files with 32 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
import requests
import pytz
from flask import render_template, url_for, redirect, flash, current_app, abort, request
from flask import render_template, url_for, redirect, flash, current_app, abort, request, session
from flask_login import current_user
from app import convert_to_boolean, current_service, service_api_client
from app.main import main
@@ -41,6 +41,9 @@ def feedback(ticket_type):
abort(404)
form = Support()
if not form.feedback.data:
form.feedback.data = session.pop('feedback_message', '')
severe = request.args.get('severe')
urgent = any((
@@ -54,6 +57,7 @@ def feedback(ticket_type):
))
if needs_triage(ticket_type, severe):
session['feedback_message'] = form.feedback.data
return redirect(url_for('.triage'))
if needs_escalation(ticket_type, severe):