Merge pull request #3009 from alphagov/no-back-link-just-sent

Hide back link when you’ve just sent a message
This commit is contained in:
Chris Hill-Scott
2019-06-11 13:31:04 +01:00
committed by GitHub
2 changed files with 12 additions and 20 deletions

View File

@@ -101,13 +101,11 @@ def view_notification(service_id, notification_id):
show_cancel_button = notification['notification_type'] == 'letter' and \ show_cancel_button = notification['notification_type'] == 'letter' and \
letter_can_be_cancelled(notification['status'], notification_created) letter_can_be_cancelled(notification['status'], notification_created)
if get_help_argument(): if get_help_argument() or request.args.get('help') == '0':
back_link = url_for( # help=0 is set when youve just sent a notification. We
'main.send_test', # only want to show the back link when youve navigated to a
service_id=current_service.id, # notification, not when youve just sent it.
template_id=template.id, back_link = None
help='2',
)
elif request.args.get('from_job'): elif request.args.get('from_job'):
back_link = url_for( back_link = url_for(
'main.view_job', 'main.view_job',

View File

@@ -125,22 +125,16 @@ def test_notification_status_page_respects_redaction(
partial(url_for, 'main.view_job', job_id='job_id'), partial(url_for, 'main.view_job', job_id='job_id'),
), ),
( (
{'help': '0'}, # not a valid help step {'help': '0'},
partial(url_for, 'main.view_notifications', message_type='sms', status='sending,delivered,failed'), None,
),
(
{'help': '0', 'from_job': 'job_id'},
partial(url_for, 'main.view_job', job_id='job_id'),
), ),
( (
{'help': '1'}, {'help': '1'},
partial( None,
url_for, ),
'main.send_test', (
service_id=SERVICE_ONE_ID, {'help': '2'},
template_id='5407f4db-51c7-4150-8758-35412d42186a', None,
help='2'
),
), ),
]) ])
def test_notification_status_shows_expected_back_link( def test_notification_status_shows_expected_back_link(