diff --git a/notifications_utils/template.py b/notifications_utils/template.py index 946d978c..38e7b53b 100644 --- a/notifications_utils/template.py +++ b/notifications_utils/template.py @@ -378,7 +378,7 @@ def preheader(self): Field( self.content, self.values, - html="escape", + html="strip" if self.allow_html else "escape", markdown_lists=True, ) ) diff --git a/notifications_utils/version.py b/notifications_utils/version.py index 39d67450..763bc1df 100644 --- a/notifications_utils/version.py +++ b/notifications_utils/version.py @@ -1,2 +1,2 @@ -__version__ = "46.1.0" +__version__ = "46.2.0" # GDS version '34.0.1' diff --git a/tests/test_template_types.py b/tests/test_template_types.py index 708b7e53..ffbefaae 100644 --- a/tests/test_template_types.py +++ b/tests/test_template_types.py @@ -338,6 +338,28 @@ def test_content_of_preheader_in_html_emails( assert mock_jinja_template.call_args[0][0]["preheader"] == expected_preheader +@pytest.mark.parametrize( + "allow_html, content, expected_preheader", + [ + (True, "Hello World", "Hello World"), + (False, "Hello World", "Hello World"), + (True, "