mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Merge pull request #1230 from alphagov/fix-entities-in-subjects
Stop template subjects getting saved encoded
This commit is contained in:
@@ -276,7 +276,7 @@ def edit_service_template(service_id, template_id):
|
|||||||
if form.process_type.data != template['process_type']:
|
if form.process_type.data != template['process_type']:
|
||||||
abort_403_if_not_admin_user()
|
abort_403_if_not_admin_user()
|
||||||
|
|
||||||
subject = escape_html(form.subject.data) if hasattr(form, 'subject') else None
|
subject = form.subject.data if hasattr(form, 'subject') else None
|
||||||
new_template = get_template({
|
new_template = get_template({
|
||||||
'name': form.name.data,
|
'name': form.name.data,
|
||||||
'content': form.template_content.data,
|
'content': form.template_content.data,
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ def test_should_show_interstitial_when_making_breaking_change(
|
|||||||
'name': "new name",
|
'name': "new name",
|
||||||
'template_content': "hello lets talk about ((thing))",
|
'template_content': "hello lets talk about ((thing))",
|
||||||
'template_type': 'email',
|
'template_type': 'email',
|
||||||
'subject': 'reminder & ((name))',
|
'subject': 'reminder \'" <span> & ((name))',
|
||||||
'service': service_id,
|
'service': service_id,
|
||||||
'process_type': 'normal'
|
'process_type': 'normal'
|
||||||
}
|
}
|
||||||
@@ -377,12 +377,18 @@ def test_should_show_interstitial_when_making_breaking_change(
|
|||||||
|
|
||||||
for key, value in {
|
for key, value in {
|
||||||
'name': 'new name',
|
'name': 'new name',
|
||||||
'subject': 'reminder & ((name))',
|
'subject': 'reminder \'" <span> & ((name))',
|
||||||
'template_content': 'hello lets talk about ((thing))',
|
'template_content': 'hello lets talk about ((thing))',
|
||||||
'confirm': 'true'
|
'confirm': 'true'
|
||||||
}.items():
|
}.items():
|
||||||
assert page.find('input', {'name': key})['value'] == value
|
assert page.find('input', {'name': key})['value'] == value
|
||||||
|
|
||||||
|
# BeautifulSoup returns the value attribute as unencoded, let’s make
|
||||||
|
# sure that it is properly encoded in the HTML
|
||||||
|
assert str(page.find('input', {'name': 'subject'})) == (
|
||||||
|
"""<input name="subject" type="hidden" value="reminder '" <span> & ((name))"/>"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_should_not_create_too_big_template(
|
def test_should_not_create_too_big_template(
|
||||||
logged_in_client,
|
logged_in_client,
|
||||||
@@ -450,7 +456,7 @@ def test_should_redirect_when_saving_a_template_email(
|
|||||||
template_id = fake_uuid
|
template_id = fake_uuid
|
||||||
name = "new name"
|
name = "new name"
|
||||||
content = "template <em>content</em> with & entity ((thing)) ((date))"
|
content = "template <em>content</em> with & entity ((thing)) ((date))"
|
||||||
subject = "subject"
|
subject = "subject & entity"
|
||||||
data = {
|
data = {
|
||||||
'id': template_id,
|
'id': template_id,
|
||||||
'name': name,
|
'name': name,
|
||||||
|
|||||||
Reference in New Issue
Block a user