From 3a218c8c51e0ff38740668b16f12d5c1e7293fc2 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 7 Jun 2017 14:00:55 +0100 Subject: [PATCH 1/3] Fix page title on international page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It doesn’t match the `

` --- app/templates/views/service-settings/set-international-sms.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/views/service-settings/set-international-sms.html b/app/templates/views/service-settings/set-international-sms.html index 76428a06b..79c733cd1 100644 --- a/app/templates/views/service-settings/set-international-sms.html +++ b/app/templates/views/service-settings/set-international-sms.html @@ -3,7 +3,7 @@ {% from "components/page-footer.html" import page_footer %} {% block service_page_title %} - Text message sender + International text messages {% endblock %} {% block maincolumn_content %} From 363a3e186458b13a3aa2c0baf8af62312a9f27c3 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 7 Jun 2017 14:14:53 +0100 Subject: [PATCH 2/3] Add settings page for inbound SMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users might be interested in inbound 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 | 6 +++ .../service-settings/set-inbound-sms.html | 43 +++++++++++++++++++ tests/app/main/views/test_service_settings.py | 13 ++++-- 4 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 app/templates/views/service-settings/set-inbound-sms.html diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 97cf75fad..d1667bfa7 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -303,6 +303,15 @@ def service_set_international_sms(service_id): ) +@main.route("/services//service-settings/set-inbound-sms", methods=['GET']) +@login_required +@user_has_permissions('manage_settings', admin_override=True) +def service_set_inbound_sms(service_id): + return render_template( + 'views/service-settings/set-inbound-sms.html', + ) + + @main.route("/services//service-settings/set-letters", methods=['GET']) @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 0a2490b9b..d587a7fc3 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -51,6 +51,12 @@ {{ edit_field('Change', url_for('.service_set_international_sms', service_id=current_service.id)) }} {% endcall %} + {% call row() %} + {{ text_field('Receive text messages') }} + {{ text_field('On' if 'inbound_sms' in current_service.permissions else 'Off') }} + {{ edit_field('Change', url_for('.service_set_inbound_sms', service_id=current_service.id)) }} + {% endcall %} + {% call row() %} {{ text_field('Letters') }} {{ text_field('On' if current_service.can_send_letters else 'Off') }} diff --git a/app/templates/views/service-settings/set-inbound-sms.html b/app/templates/views/service-settings/set-inbound-sms.html new file mode 100644 index 000000000..ffafb8847 --- /dev/null +++ b/app/templates/views/service-settings/set-inbound-sms.html @@ -0,0 +1,43 @@ +{% extends "withnav_template.html" %} +{% from "components/textbox.html" import textbox %} +{% from "components/page-footer.html" import page_footer %} + +{% block service_page_title %} + Receive text messages +{% endblock %} + +{% block maincolumn_content %} + +
+
+

Receive text messages

+ {% if 'inbound_sms' in current_service.permissions %} +

+ Your service can receive text messages sent to {{ current_service.sms_sender }}. +

+

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

+ {% else %} +

+ Receiving text messages from your users is an + invitation‑only feature. +

+

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

+

+ We’ll set you up with a special phone number, and you’ll be able to see + the messages on your dashboard, or get them using the API. +

+ {% 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 4d9ba1814..4228d4f8e 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -21,6 +21,7 @@ from tests.conftest import active_user_with_permissions, platform_admin_user 'Email reply to address None Change', 'Text message sender GOVUK Change', 'International text messages Off Change', + 'Receive text messages Off Change', 'Letters Off Change', ]), (platform_admin_user, [ @@ -29,6 +30,7 @@ from tests.conftest import active_user_with_permissions, platform_admin_user 'Email reply to address None Change', 'Text message sender GOVUK Change', 'International text messages Off Change', + 'Receive text messages Off Change', 'Letters Off Change', 'Label Value Action', 'Email branding GOV.UK Change', @@ -67,6 +69,8 @@ def test_should_show_overview_for_service_with_more_things_set( mock_get_letter_organisations, ): client.login(active_user_with_permissions, mocker, service_with_reply_to_addresses) + service_with_reply_to_addresses['permissions'] = ['inbound_sms'] + service_with_reply_to_addresses['can_send_international_sms'] = True response = client.get(url_for( 'main.service_settings', service_id=service_with_reply_to_addresses['id'] )) @@ -74,8 +78,9 @@ 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', - 'International text messages Off Change', + 'Text message sender elevenchars', + 'International text messages On Change', + 'Receive text messages On Change', 'Letters Off Change', ]): assert row == " ".join(page.find_all('tr')[index + 1].text.split()) @@ -120,7 +125,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')[6].find_all('td')[1].div + div = page.find_all('tr')[7].find_all('td')[1].div assert div.text.strip() == 'None' assert 'default' in div.attrs['class'][0] @@ -138,7 +143,7 @@ def test_escapes_letter_contact_block( )) page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - div = str(page.find_all('tr')[6].find_all('td')[1].div) + div = str(page.find_all('tr')[7].find_all('td')[1].div) assert 'foo
bar' in div assert '