mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 08:31:00 -04:00
handle if user doesn't provide name/email
also clean up usage of DESKPRO_PERSON_EMAIL and put it in the conf rather than env
This commit is contained in:
@@ -8,18 +8,19 @@ from app.main.forms import Feedback
|
||||
def feedback():
|
||||
form = Feedback()
|
||||
if form.validate_on_submit():
|
||||
user_supplied_email = form.email_address.data != ''
|
||||
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),
|
||||
form.feedback.data
|
||||
)
|
||||
data = {
|
||||
'person_email': form.email_address.data,
|
||||
'person_name': form.name.data,
|
||||
'person_email': form.email_address.data or current_app.config.get('DESKPRO_PERSON_EMAIL'),
|
||||
'person_name': form.name.data or None,
|
||||
'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': 'Environment: {}\n\n{}\n{}\n{}'.format(
|
||||
url_for('main.index', _external=True),
|
||||
form.name.data,
|
||||
form.email_address.data,
|
||||
form.feedback.data
|
||||
)
|
||||
'message': feedback_msg
|
||||
}
|
||||
headers = {
|
||||
"X-DeskPRO-API-Key": current_app.config.get('DESKPRO_API_KEY'),
|
||||
|
||||
@@ -108,9 +108,7 @@ def service_request_to_go_live(service_id):
|
||||
'department_id': current_app.config.get('DESKPRO_DEPT_ID'),
|
||||
'agent_team_id': current_app.config.get('DESKPRO_ASSIGNED_AGENT_TEAM_ID'),
|
||||
'subject': 'Request to go live',
|
||||
'message': "From {} <{}> on behalf of {} ({})\n\nUsage estimate\n---\n\n{}".format(
|
||||
current_user.name,
|
||||
current_user.email_address,
|
||||
'message': "On behalf of {} ({})\n\nUsage estimate\n---\n\n{}".format(
|
||||
current_service['name'],
|
||||
url_for('main.service_dashboard', service_id=current_service['id'], _external=True),
|
||||
form.usage.data
|
||||
|
||||
Reference in New Issue
Block a user