Skip to content

Commit

Permalink
Merge pull request #587 from CityOfNewYork/johnyu95-email-point-of-co…
Browse files Browse the repository at this point in the history
…ntact

Acknowledgement Email Point of Contact
  • Loading branch information
johnyu95 authored Dec 12, 2024
2 parents 1d9100d + 618aa60 commit 579dbbf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/constants/schemas/agencies.schema
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
"description": "An array of agency EINs. Each EIN must be unique. Used to notify a \"parent\" agency of requests submitted to the \"child\"",
"uniqueItems": true
},
"use_point_of_contact": {
"$id": "/properties/agencies/items/properties/agency_features/properties/use_point_of_contact",
"type": "boolean",
"title": "Use Point of Contact",
"description": "Boolean value that determines if point of contact information should be used in email templates.",
},
"letters": {
"generate_letters": {
"$id": "/properties/agencies/items/properties/agency_features/properties/letters/properties/generate_letters",
Expand Down
9 changes: 8 additions & 1 deletion app/response/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,9 @@ def _acknowledgment_email_handler(request_id, data, page, agency_name, email_tem
else:
description_hidden_by_default = False

# Determine if point of contact should be used
use_point_of_contact = request.agency.agency_features.get('use_point_of_contact', False)

if acknowledgment is not None:
acknowledgment = json.loads(acknowledgment)
default_content = True
Expand All @@ -1165,11 +1168,13 @@ def _acknowledgment_email_handler(request_id, data, page, agency_name, email_tem
acknowledgment['date'],
data['tz_name'])
info = acknowledgment['info'].strip() or None
point_of_contact = assign_point_of_contact(acknowledgment.get('point_of_contact', None))
else:
default_content = False
content = data['email_content']
date = None
info = None
point_of_contact = None
return jsonify({"template": render_template(email_template,
custom_request_forms_enabled=custom_request_forms_enabled,
default_content=default_content,
Expand All @@ -1180,7 +1185,9 @@ def _acknowledgment_email_handler(request_id, data, page, agency_name, email_tem
agency_name=agency_name,
date=date,
info=info,
page=page),
page=page,
use_point_of_contact=use_point_of_contact,
point_of_contact=point_of_contact),
"header": header}), 200


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
{{ info | safe }}
<br/><br/>
{% endif %}
{% if use_point_of_contact %}
<p>Your request has been assigned to {{ point_of_contact.title }} {{ point_of_contact.last_name }}
({{ point_of_contact.formatted_point_of_contact_number }}) of this office.</p>
{% endif %}
Please visit <a href="{{ page }}">{{ request_id }}</a> to view additional information and take any necessary action.
</div>
{% else %}
Expand Down
3 changes: 2 additions & 1 deletion app/templates/response/add_acknowledgment.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@
acknowledgment: JSON.stringify({
days: email_days.val(),
date: email_date.val(),
info: tinyMCE.get('acknowledgment-email-info-text').getContent()
info: tinyMCE.get('acknowledgment-email-info-text').getContent(),
point_of_contact: point_of_contact.val()
}),
tz_name: jstz.determine().name()
},
Expand Down

0 comments on commit 579dbbf

Please sign in to comment.