Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Add changed values to facility update emails
Browse files Browse the repository at this point in the history
When notifying contributors when facility claimants change the profile of a
facility we want to include the specific public details that were changed.

The non-standard position of the `endfor` in the plain text email template is
intentional and ensures that extra blank lines are not included.
  • Loading branch information
jwalgran committed Jul 9, 2019
1 parent 104db3a commit 9ec1543
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/django/api/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,19 @@ def send_claim_update_note_to_one_contributor(request, claim, contributor):

facility_country = COUNTRY_NAMES[claim.facility.country_code]

changes = claim.get_changes()
if changes:
changes = [
'{}: {}'.format(c['verbose_name'], c['current'])
for c in changes
]

notice_dictionary = {
'facility_name': claim.facility.name,
'facility_address': claim.facility.address,
'facility_country': facility_country,
'facility_url': make_facility_url(request, claim.facility),
'changes': changes,
}

send_mail(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
Facility URL: {{ facility_url }}
</li>
</ul>
{% if changes %}
<p>The following details have been changed:</p>
<ul>
{% for change in changes %}
<li>{{ change }}</li>
{% endfor %}
</ul>
{% endif %}
<p>
Sincerely,
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ The facility is:
- Facility: {{ facility_name }}, {{ facility_address }}, {{ facility_country }}
- Facility URL: {{ facility_url }}

{% if changes %}
The following details have been changed:

{% for change in changes %}
- {{ change }} {% endfor %}
{% endif %}

Sincerely,
{% include "mail/signature_block.txt" %}
{% endblock content %}

0 comments on commit 9ec1543

Please sign in to comment.