diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index 5cff773e7..710d8f97d 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -78,7 +78,10 @@ def view_notification(service_id, notification_id): page_count = get_page_count_for_letter(notification['template'], values=personalisation) if notification.get('postage'): - notification['template']['postage'] = notification['postage'] + if notification["status"] == "validation-failed": + notification['template']['postage'] = None + else: + notification['template']['postage'] = notification['postage'] template = get_template( notification['template'], current_service, diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index 590e61c89..8062a17da 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -405,6 +405,7 @@ def test_notification_page_shows_validation_failed_precompiled_letter( assert not page.select('p.notification-status') assert page.select_one('main img')['src'].endswith('.png?page=1') + assert not page.select('.letter-postage') @pytest.mark.parametrize('notification_status, expected_message', (