display service name in feedback email if user is logged in

also, split out a couple of tests for legibility and clear up some
linter errors
This commit is contained in:
Leo Hemsted
2017-01-30 14:18:19 +00:00
committed by Chris Hill-Scott
parent 154271b46e
commit 199dc24cb8
2 changed files with 72 additions and 51 deletions

View File

@@ -74,8 +74,17 @@ def feedback(ticket_type):
if form.validate_on_submit():
user_email = form.email_address.data
user_name = form.name.data or None
feedback_msg = 'Environment: {}\n{}\n{}'.format(
if current_service:
service_string = 'Service "{name}": {url}\n'.format(
name=current_service['name'],
url=url_for('main.service_dashboard', service_id=current_service['id'], _external=True)
)
else:
service_string = ''
feedback_msg = 'Environment: {}\n{}{}\n{}'.format(
url_for('main.index', _external=True),
service_string,
'' if user_email else '{} (no email address supplied)'.format(form.name.data),
form.feedback.data
)