Merge pull request #2729 from alphagov/validate_send_file_by_email_contact_deets

All services can send files by email if they have set contact_link
This commit is contained in:
Pea M. Tyczynska
2020-02-27 15:48:08 +00:00
committed by GitHub
4 changed files with 45 additions and 10 deletions

View File

@@ -85,7 +85,16 @@ def service_has_permission(notify_type, permissions):
def check_service_has_permission(notify_type, permissions):
if not service_has_permission(notify_type, permissions):
raise BadRequestError(message="Service is not allowed to send {}".format(
get_public_notify_type_text(notify_type, plural=True)))
get_public_notify_type_text(notify_type, plural=True)
))
def check_if_service_can_send_files_by_email(service_contact_link, service_id):
if not service_contact_link:
raise BadRequestError(
message=f"Send files by email has not been set up - add contact details for your service at "
f"{current_app.config['ADMIN_BASE_URL']}/services/{service_id}/service-settings/send-files-by-email"
)
def check_service_can_schedule_notification(permissions, scheduled_for):