Skip to content

Commit

Permalink
[#2119] Added status to case update emails
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Schoor committed Feb 26, 2024
1 parent 6282dd5 commit 8bc0142
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/open_inwoner/conf/parts/case_status_notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h2>{{ type_description }}</h2>
<img src="/static/img/mail/info_info-blue.jpg" width="20" height="20" alt="" class="mail__icon">
</td>
<td class="td__padding-top td__padding-right td__padding-bottom">
<p class="text-color__info">De status is gewijzigd naar <span class="status_current"><strong><a href="{{ case_link }}" class="text-color__info">{{ type_description }}</a></strong></span>.</p>
<p class="text-color__info">De status is gewijzigd naar <span class="status_current"><strong><a href="{{ case_link }}" class="text-color__info">{{ status_description }}</a></strong></span>.</p>
</td>
</tr>
</table>
Expand Down
8 changes: 6 additions & 2 deletions src/open_inwoner/conf/parts/maileditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def _readfile(name):
"description": _("The description of the type of the case"),
},
{
"name": "case_link",
"description": _("The link to the case details."),
"name": "status_description",
"description": _("The description of the status of the case"),
},
{
"name": "end_date",
Expand Down Expand Up @@ -311,6 +311,10 @@ def _readfile(name):
"name": "type_description",
"description": _("The description of the type of the case"),
},
{
"name": "status_description",
"description": _("The description of the status of the case"),
},
{
"name": "case_link",
"description": _("The link to the case details."),
Expand Down
9 changes: 7 additions & 2 deletions src/open_inwoner/openzaak/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def handle_status_update(
else:
template_name = "case_status_notification"

send_case_update_email(user, case, template_name)
send_case_update_email(user, case, status, template_name)
note.mark_sent()

log_system_action(
Expand All @@ -563,7 +563,11 @@ def handle_status_update(


def send_case_update_email(
user: User, case: Zaak, template_name: str, extra_context: dict = None
user: User,
case: Zaak,
status: Status,
template_name: str,
extra_context: dict = None,
):
"""
send the actual mail
Expand All @@ -578,6 +582,7 @@ def send_case_update_email(
context = {
"identification": case.identification,
"type_description": case.zaaktype.omschrijving,
"status_description": status.statustype.omschrijving,
"start_date": case.startdatum,
"end_date": date.today() + timedelta(days=config.action_required_deadline_days),
"case_link": case_detail_url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ def test_handle_status_update(self, mock_send: Mock, mock_feed_hook: Mock):
args = mock_send.call_args.args
self.assertEqual(args[0], user)
self.assertEqual(args[1].url, case.url)
self.assertEqual(args[2], "case_status_notification")
self.assertEqual(args[2], status)
self.assertEqual(args[3], "case_status_notification")

mock_send.reset_mock()

Expand Down Expand Up @@ -694,4 +695,5 @@ def test_action_required_template(self, mock_send: Mock, mock_feed_hook: Mock):
args = mock_send.call_args.args
self.assertEqual(args[0], user)
self.assertEqual(args[1].url, case.url)
self.assertEqual(args[2], "case_status_notification_action_required")
self.assertEqual(args[2], status)
self.assertEqual(args[3], "case_status_notification_action_required")

0 comments on commit 8bc0142

Please sign in to comment.