Skip to content

Commit

Permalink
the email subject is now unescaped in the serialized version.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchlwellman committed Dec 13, 2024
1 parent 8904910 commit a9d8465
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any, Dict, Optional

import datetime
import html
import itertools
import uuid

Expand Down Expand Up @@ -1342,7 +1343,7 @@ def subject(self):
template_object = get_template_instance(
self.template.__dict__, {k: '<redacted>' for k in self.personalisation}
)
return str(template_object.subject)
return html.unescape(str(template_object.subject))

@property
def formatted_status(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_notification_subject_fills_in_placeholders(
):
template = sample_template(template_type=EMAIL_TYPE, subject='((name))')
notification = sample_notification(template=template, personalisation={'name': 'hello'})
assert notification.subject == '&lt;redacted&gt;'
assert notification.subject == '<redacted>'


def test_notification_serializes_created_by_name_with_no_created_by_id(client, sample_notification):
Expand Down
2 changes: 1 addition & 1 deletion tests/app/v2/notifications/test_get_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,4 +933,4 @@ def test_get_notifications_removes_personalisation_from_subject(

json_response = json.loads(response.get_data(as_text=True))
assert response.status_code == 200
assert json_response['subject'] == 'Hello &lt;redacted&gt;'
assert json_response['subject'] == 'Hello <redacted>'

0 comments on commit a9d8465

Please sign in to comment.