mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Don’t ask for a user’s email address if we know it
If a user is logged in then we already know their name and email address. So there’s no need for them to fill them again on the support form. One concern we might have about this is the user not realising we’re doing this, and the feedback form looking like a bit of a black hole. So we’re replaying their email address on this page to reassure them that: - we know who they are - and that they’ll get a reply
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import requests
|
||||
from flask import render_template, url_for, redirect, flash, current_app, abort
|
||||
from flask_login import current_user
|
||||
from app.main import main
|
||||
from app.main.forms import SupportType, Feedback
|
||||
|
||||
@@ -21,15 +22,20 @@ def feedback(ticket_type):
|
||||
abort(404)
|
||||
form = Feedback()
|
||||
if form.validate_on_submit():
|
||||
user_supplied_email = form.email_address.data != ''
|
||||
if current_user.is_authenticated:
|
||||
user_email = current_user.email_address
|
||||
user_name = current_user.name
|
||||
else:
|
||||
user_email = form.email_address.data
|
||||
user_name = form.name.data or None
|
||||
feedback_msg = 'Environment: {}\n{}\n{}'.format(
|
||||
url_for('main.index', _external=True),
|
||||
'' if user_supplied_email else '{} (no email address supplied)'.format(form.name.data),
|
||||
'' if user_email else '{} (no email address supplied)'.format(form.name.data),
|
||||
form.feedback.data
|
||||
)
|
||||
data = {
|
||||
'person_email': form.email_address.data or current_app.config.get('DESKPRO_PERSON_EMAIL'),
|
||||
'person_name': form.name.data or None,
|
||||
'person_email': user_email or current_app.config.get('DESKPRO_PERSON_EMAIL'),
|
||||
'person_name': user_name,
|
||||
'department_id': current_app.config.get('DESKPRO_DEPT_ID'),
|
||||
'agent_team_id': current_app.config.get('DESKPRO_ASSIGNED_AGENT_TEAM_ID'),
|
||||
'subject': 'Notify feedback',
|
||||
|
||||
Reference in New Issue
Block a user