diff --git a/app/request/utils.py b/app/request/utils.py index c1bb234c8..9df38dd5c 100644 --- a/app/request/utils.py +++ b/app/request/utils.py @@ -25,6 +25,7 @@ ACKNOWLEDGMENT_DAYS_DUE, REQUESTER_ACKNOWLEDGMENT_DAYS_DUE, user_type_request, + response_type ) from app.constants.response_privacy import ( RELEASE_AND_PRIVATE, @@ -54,9 +55,13 @@ UserRequests, Roles, Files, - ResponseTokens + ResponseTokens, + Responses, +) +from app.response.utils import ( + safely_send_and_add_email, + get_file_links ) -from app.response.utils import safely_send_and_add_email from app.upload.constants import upload_status from app.upload.utils import ( is_valid_file_type, @@ -429,6 +434,13 @@ def send_confirmation_email(request, agency, user): requester_email = user.email address = user.mailing_address + # gets the file link, if a file was provided. + file_response = request.responses.filter(Responses.type == response_type.FILE).one_or_none() + release_public, release_private, private = ([] for i in range(3)) + if file_response is not None: + get_file_links(file_response, release_public, release_private, private) + file_link = release_private[0] if len(release_private) > 0 else None + # generates the view request page URL for this request if agency.is_active: page = urljoin(flask_request.host_url, url_for('request.view', request_id=request.id)) @@ -446,6 +458,7 @@ def send_confirmation_email(request, agency, user): agency_default_email=agency_default_email, user=user, address=address, + file_link=file_link, page=page) try: diff --git a/app/request/views.py b/app/request/views.py index 342010e44..28d45e83b 100644 --- a/app/request/views.py +++ b/app/request/views.py @@ -23,7 +23,7 @@ from app.constants import ( request_status, - permission + permission, ) from app.lib.date_utils import ( DEFAULT_YEARS_HOLIDAY_LIST, @@ -148,6 +148,7 @@ def new(): current_request = Requests.query.filter_by(id=request_id).first() requester = current_request.requester + send_confirmation_email(request=current_request, agency=current_request.agency, user=requester) if current_request.agency.is_active: diff --git a/app/templates/email_templates/email_confirmation.html b/app/templates/email_templates/email_confirmation.html index bba44d36d..147ad2bdf 100644 --- a/app/templates/email_templates/email_confirmation.html +++ b/app/templates/email_templates/email_confirmation.html @@ -18,7 +18,11 @@ Request Description: {{ current_request.description }}

- + {% if file %} + Attached File: {{ file['title'] }}: {{ file['filename'] }} +
+
+ {% endif %}

Requester's Contact Information

diff --git a/app/templates/email_templates/email_not_onboarded.html b/app/templates/email_templates/email_not_onboarded.html index 5019a7433..3c4f45c68 100644 --- a/app/templates/email_templates/email_not_onboarded.html +++ b/app/templates/email_templates/email_not_onboarded.html @@ -20,7 +20,11 @@ Request Description: {{ current_request.description }}

- + {% if file %} + Attached File: {{ file['title'] }}:
{{ file['filename'] }} +
+
+ {% endif %}

Requester's Contact Information