From 49b73cfe638a86218e838672d32a4ff90b7013dd Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 27 Apr 2017 14:26:25 +0100 Subject: [PATCH] Tell users international text messaging is coming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users might be interested in international SMS. And when it’s fully available, they’ll probably be able to control whether it’s on/off for their service. Until they point, the only way of getting it is to ask us. So let’s make an in-the-meantime page that directs them to ask us, from the place where they’d be able to do it themselves. --- app/main/views/service_settings.py | 9 +++++ app/templates/views/service-settings.html | 5 +++ .../set-international-sms.html | 39 +++++++++++++++++++ tests/app/main/views/test_service_settings.py | 11 ++++-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 app/templates/views/service-settings/set-international-sms.html diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 52c914307..8517aa2fd 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -277,6 +277,15 @@ def service_set_sms_sender(service_id): form=form) +@main.route("/services//service-settings/set-international-sms", methods=['GET']) +@login_required +@user_has_permissions('manage_settings', admin_override=True) +def service_set_international_sms(service_id): + return render_template( + 'views/service-settings/set-international-sms.html', + ) + + @main.route("/services//service-settings/set-letter-contact-block", methods=['GET', 'POST']) @login_required @user_has_permissions('manage_settings', admin_override=True) diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 07c0d8dbf..eb3ed8c2d 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -39,6 +39,11 @@ {{ text_field(current_service.sms_sender or '40604') }} {{ edit_field('Change', url_for('.service_set_sms_sender', service_id=current_service.id)) }} {% endcall %} + {% call row() %} + {{ text_field('International text messages') }} + {{ text_field('On' if current_service.can_send_international_sms else 'Off') }} + {{ edit_field('Change', url_for('.service_set_international_sms', service_id=current_service.id)) }} + {% endcall %} {% if current_service.can_send_letters %} {% call row() %} diff --git a/app/templates/views/service-settings/set-international-sms.html b/app/templates/views/service-settings/set-international-sms.html new file mode 100644 index 000000000..76428a06b --- /dev/null +++ b/app/templates/views/service-settings/set-international-sms.html @@ -0,0 +1,39 @@ +{% extends "withnav_template.html" %} +{% from "components/textbox.html" import textbox %} +{% from "components/page-footer.html" import page_footer %} + +{% block service_page_title %} + Text message sender +{% endblock %} + +{% block maincolumn_content %} + +
+
+

International text messages

+ {% if current_service.can_send_international_sms %} +

+ Your service can send text messages to international phone numbers. +

+

+ If you want to turn it off, + get in touch with the GOV.UK Notify team. +

+ {% else %} +

+ Sending text messages to international phone numbers is an + invitation‑only feature. +

+

+ If you want to try it out, + get in touch with the GOV.UK Notify team. +

+ {% endif %} + {{ page_footer( + back_link=url_for('.service_settings', service_id=current_service.id), + back_link_text='Back to settings' + ) }} +
+
+ +{% endblock %} diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index a4a72a04c..ad7c9663a 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -18,13 +18,15 @@ from tests.conftest import active_user_with_permissions, platform_admin_user 'Label Value Action', 'Service name service one Change', 'Email reply to address None Change', - 'Text message sender 40604 Change' + 'Text message sender 40604 Change', + 'International text messages Off Change', ]), (platform_admin_user, [ 'Label Value Action', 'Service name service one Change', 'Email reply to address None Change', 'Text message sender 40604 Change', + 'International text messages Off Change', 'Label Value Action', 'Email branding GOV.UK Change', 'Letter branding HM Government Change', @@ -69,7 +71,8 @@ def test_should_show_overview_for_service_with_more_things_set( for index, row in enumerate([ 'Service name service one Change', 'Email reply to address test@example.com Change', - 'Text message sender elevenchars Change' + 'Text message sender elevenchars Change', + 'International text messages Off Change', ]): assert row == " ".join(page.find_all('tr')[index + 1].text.split()) @@ -97,7 +100,7 @@ def test_letter_contact_block_shows_None_if_not_set( )) page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - div = page.find_all('tr')[4].find_all('td')[1].div + div = page.find_all('tr')[5].find_all('td')[1].div assert div.text.strip() == 'None' assert 'default' in div.attrs['class'][0] @@ -115,7 +118,7 @@ def test_escapes_letter_contact_block( )) page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - div = str(page.find_all('tr')[4].find_all('td')[1].div) + div = str(page.find_all('tr')[5].find_all('td')[1].div) assert 'foo
bar' in div assert '