Check text message sender before going live

We often check that a service has an appropriate text message sender as
a condition of them going live. We don’t mention this anywhere.

The services for whom GOVUK is definitely not an appropriate sender are
those in local government. As we have more of these teams starting to
use Notify, we should streamline the process by making this check
automated.

This commit adds that check, for teams who:
- have text message templates
- have self-declared as NHS or local government
This commit is contained in:
Chris Hill-Scott
2018-08-23 16:11:08 +01:00
parent fbd2102832
commit 45eb16b4db
4 changed files with 140 additions and 8 deletions

View File

@@ -25,6 +25,7 @@ from flask import (
url_for,
)
from flask_login import current_user
from notifications_utils.field import Field
from notifications_utils.formatters import make_quotes_smart
from notifications_utils.recipients import RecipientCSV
from notifications_utils.take import Take
@@ -663,3 +664,10 @@ def should_skip_template_page(template_type):
not current_user.has_permissions('manage_templates', 'manage_api_keys') and
template_type != 'letter'
)
def get_default_sms_sender(sms_senders):
return str(next((
Field(x['sms_sender'], html='escape')
for x in sms_senders if x['is_default']
), "None"))