diff --git a/app/service/send_notification.py b/app/service/send_notification.py index 119f0a38d..28208eea8 100644 --- a/app/service/send_notification.py +++ b/app/service/send_notification.py @@ -169,6 +169,10 @@ def send_pdf_letter_notification(service_id, post_data): allow_guest_list_recipients=False, ) + # notification already exists e.g. if the user clicked send in different tabs + if get_notification_by_id(post_data['file_id']): + return {'id': str(post_data['file_id'])} + template = get_precompiled_letter_template(service.id) file_location = 'service-{}/{}.pdf'.format(service.id, post_data['file_id']) @@ -179,10 +183,6 @@ def send_pdf_letter_notification(service_id, post_data): post_data['file_id'], current_app.config['TRANSIENT_UPLOADED_LETTERS']) ) - # notification already exists e.g. if the user clicked send in different tabs - if get_notification_by_id(post_data['file_id']): - return {'id': str(post_data['file_id'])} - raise e # Getting the page count won't raise an error since admin has already checked the PDF is valid