Don’t show the postage when validation has failed

The postage covers up some of the letter, so it can hide the problem. It
also implies that the letter has been put in an envelope, which will
never happen if it fails validation.

This matches what we do for uploaded letters.
This commit is contained in:
Chris Hill-Scott
2020-03-03 11:39:31 +00:00
parent 3cfceda0b8
commit b236df523c
2 changed files with 5 additions and 1 deletions

View File

@@ -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,

View File

@@ -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', (