diff --git a/app/main/forms.py b/app/main/forms.py index 34a6d8616..eb60cc8f4 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -502,7 +502,11 @@ class ServiceSmsSender(Form): class ServiceLetterContactBlock(Form): - letter_contact_block = TextAreaField() + letter_contact_block = TextAreaField( + validators=[ + NoCommasInPlaceHolders() + ] + ) def validate_letter_contact_block(form, field): line_count = field.data.strip().count('\n') diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index d891164ea..e8a32fc1b 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -14,6 +14,8 @@ from flask_login import ( login_required, current_user ) + +from notifications_utils.field import Field from notifications_python_client.errors import HTTPError from app import service_api_client @@ -46,7 +48,8 @@ def service_settings(service_id): organisation=organisation, letter_branding=letter_branding_organisations.get( current_service.get('dvla_organisation', '001') - ) + ), + letter_contact_block=Field(current_service['letter_contact_block'], html='escape') ) diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 153069c93..1bca9cf33 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -56,7 +56,7 @@ {% call row() %} {{ text_field('Letter contact details') }} {% call field(status='' if current_service.letter_contact_block else 'default') %} - {{ current_service.letter_contact_block | escape | nl2br | safe }} + {{ letter_contact_block | string | nl2br | safe if current_service.letter_contact_block else 'None'}} {% endcall %} {{ edit_field('Change', url_for('.service_set_letter_contact_block', service_id=current_service.id)) }} {% endcall %} diff --git a/app/templates/views/service-settings/set-letter-contact-block.html b/app/templates/views/service-settings/set-letter-contact-block.html index c33121942..ddd46ffe6 100644 --- a/app/templates/views/service-settings/set-letter-contact-block.html +++ b/app/templates/views/service-settings/set-letter-contact-block.html @@ -18,7 +18,8 @@ label='How should users contact your service?
This applies to all the letters you send.'|safe, hint='10 lines maximum', width='1-1', - rows=10 + rows=10, + highlight_tags=True ) }} {{ page_footer( 'Save', diff --git a/requirements.txt b/requirements.txt index 738e5f12f..98ed8f5bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,4 +28,4 @@ notifications-python-client>=3.1,<3.2 awscli>=1.11,<1.12 awscli-cwlogs>=1.4,<1.5 -git+https://github.com/alphagov/notifications-utils.git@17.0.1#egg=notifications-utils==17.0.1 +git+https://github.com/alphagov/notifications-utils.git@17.1.2#egg=notifications-utils==17.1.2