From a9d8465518d70adcc54d7b7f6eace99dad3be7ff Mon Sep 17 00:00:00 2001 From: Michael Wellman Date: Fri, 13 Dec 2024 15:50:11 -0500 Subject: [PATCH] the email subject is now unescaped in the serialized version. --- app/models.py | 3 ++- tests/app/test_model.py | 2 +- tests/app/v2/notifications/test_get_notifications.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models.py b/app/models.py index d397419aac..658845759f 100644 --- a/app/models.py +++ b/app/models.py @@ -2,6 +2,7 @@ from typing import Any, Dict, Optional import datetime +import html import itertools import uuid @@ -1342,7 +1343,7 @@ def subject(self): template_object = get_template_instance( self.template.__dict__, {k: '' for k in self.personalisation} ) - return str(template_object.subject) + return html.unescape(str(template_object.subject)) @property def formatted_status(self): diff --git a/tests/app/test_model.py b/tests/app/test_model.py index eb0ac07971..6bc05b3611 100644 --- a/tests/app/test_model.py +++ b/tests/app/test_model.py @@ -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 == '<redacted>' + assert notification.subject == '' def test_notification_serializes_created_by_name_with_no_created_by_id(client, sample_notification): diff --git a/tests/app/v2/notifications/test_get_notifications.py b/tests/app/v2/notifications/test_get_notifications.py index 8f3b4d268c..3a6d43839f 100644 --- a/tests/app/v2/notifications/test_get_notifications.py +++ b/tests/app/v2/notifications/test_get_notifications.py @@ -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 <redacted>' + assert json_response['subject'] == 'Hello '