Fix HTML showing up on breaking change page

The breaking change page temporarily holds the changes in hidden inputs
on the page. The messages content it gets from the `.content` property
on the subject. This is raw and not transformed in any way, so fine.

For the subject it gets the value from the `.subject` attribute on the
template. For email templates, this will be transformed to highlight
placeholders with `<span class='placeholder'>…`. This means that when
the change is confirmed, it’s this encoded version that gets sent to the
API. Which is bad, because we then save `<span class='placeholder'>` in
the database.

This commit changes the page to look at the `._subject` attribute
instead, which is the internal, untransformed version of the subject.
This commit is contained in:
Chris Hill-Scott
2017-03-07 15:11:37 +00:00
parent c51c954efc
commit 7e185f67b1
3 changed files with 7 additions and 6 deletions

View File

@@ -263,9 +263,9 @@ def test_should_show_interstitial_when_making_breaking_change(
data={
'id': template_id,
'name': "new name",
'template_content': "hello ((name)) lets talk about ((thing))",
'template_content': "hello lets talk about ((thing))",
'template_type': 'email',
'subject': 'reminder',
'subject': 'reminder & ((name))',
'service': service_id,
'process_type': 'normal'
}
@@ -286,8 +286,8 @@ def test_should_show_interstitial_when_making_breaking_change(
for key, value in {
'name': 'new name',
'subject': 'reminder',
'template_content': 'hello ((name)) lets talk about ((thing))',
'subject': 'reminder &amp; ((name))',
'template_content': 'hello lets talk about ((thing))',
'confirm': 'true'
}.items():
assert page.find('input', {'name': key})['value'] == value