mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-03-20 10:15:14 -04:00
Fix ‘help’ appearing when it shouldn’t
Steps to reproduce:
- make a template with a placeholder
- click ‘send yourself a test’
- leave fields blank
- click ‘check’
- see error, click ‘back’
Expected: previous page
Actual: previous page with blue help sidebar
When the URL contains `help=0`, `request.args.get('help')` returns '0'.
Doing `if '0':` is the same as doing any `if <non empty string>:` which
returns `True`.
So we should only display the help when the help query parameter is:
- not missing
- AND a string that isn’t `'0'`
This commit is contained in:
@@ -243,7 +243,7 @@ def check_messages(service_id, template_type, upload_id):
|
||||
)
|
||||
|
||||
if request.args.get('from_test') and len(template.placeholders):
|
||||
extra_args = {'help': 1} if request.args.get('help') else {}
|
||||
extra_args = {'help': 1} if request.args.get('help', '0') != '0' else {}
|
||||
back_link = url_for(
|
||||
'.send_test', service_id=service_id, template_id=template.id, **extra_args
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user