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 10, 2019
1 parent db35741 commit 6d1860f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/django/api/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,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>
Best wishes,
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ The facility is:
- Facility: {{ facility_name }}, {{ facility_address }}, {{ facility_country }}
- Facility URL: {{ facility_url }}

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

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

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

0 comments on commit 6d1860f

Please sign in to comment.