mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge pull request #1178 from alphagov/fix-html-showing-up-breaking-change
Fix HTML showing up on breaking change page
This commit is contained in:
@@ -6,6 +6,7 @@ from flask_login import login_required, current_user
|
|||||||
from flask_weasyprint import HTML, render_pdf
|
from flask_weasyprint import HTML, render_pdf
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
from notifications_utils.field import escape_html
|
||||||
from notifications_utils.template import LetterPreviewTemplate
|
from notifications_utils.template import LetterPreviewTemplate
|
||||||
from notifications_utils.recipients import first_column_headings
|
from notifications_utils.recipients import first_column_headings
|
||||||
from notifications_python_client.errors import HTTPError
|
from notifications_python_client.errors import HTTPError
|
||||||
@@ -248,7 +249,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 = form.subject.data if hasattr(form, 'subject') else None
|
subject = escape_html(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,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="name" value="{{ new_template.name }}" />
|
<input type="hidden" name="name" value="{{ new_template.name }}" />
|
||||||
<input type="hidden" name="subject" value="{{ new_template.subject or '' }}" />
|
<input type="hidden" name="subject" value="{{ new_template._subject or '' }}" />
|
||||||
<input type="hidden" name="template_content" value="{{ new_template.content }}" />
|
<input type="hidden" name="template_content" value="{{ new_template.content }}" />
|
||||||
<input type="hidden" name="template_id" value="{{ new_template.id }}" />
|
<input type="hidden" name="template_id" value="{{ new_template.id }}" />
|
||||||
|
|
||||||
|
|||||||
@@ -263,9 +263,9 @@ def test_should_show_interstitial_when_making_breaking_change(
|
|||||||
data={
|
data={
|
||||||
'id': template_id,
|
'id': template_id,
|
||||||
'name': "new name",
|
'name': "new name",
|
||||||
'template_content': "hello ((name)) lets talk about ((thing))",
|
'template_content': "hello lets talk about ((thing))",
|
||||||
'template_type': 'email',
|
'template_type': 'email',
|
||||||
'subject': 'reminder',
|
'subject': 'reminder & ((name))',
|
||||||
'service': service_id,
|
'service': service_id,
|
||||||
'process_type': 'normal'
|
'process_type': 'normal'
|
||||||
}
|
}
|
||||||
@@ -286,8 +286,8 @@ 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',
|
'subject': 'reminder & ((name))',
|
||||||
'template_content': 'hello ((name)) 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
|
||||||
|
|||||||
Reference in New Issue
Block a user