mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Make sure empty inbox also show the correct number
…since it’s divorced from the SMS sender now.
This commit is contained in:
@@ -18,7 +18,8 @@ from app import (
|
|||||||
billing_api_client,
|
billing_api_client,
|
||||||
job_api_client,
|
job_api_client,
|
||||||
service_api_client,
|
service_api_client,
|
||||||
template_statistics_client
|
template_statistics_client,
|
||||||
|
inbound_number_client,
|
||||||
)
|
)
|
||||||
from app.statistics_utils import get_formatted_percentage, add_rate_to_job
|
from app.statistics_utils import get_formatted_percentage, add_rate_to_job
|
||||||
from app.utils import (
|
from app.utils import (
|
||||||
@@ -175,11 +176,17 @@ def get_inbox_partials(service_id):
|
|||||||
}:
|
}:
|
||||||
messages_to_show.append(message)
|
messages_to_show.append(message)
|
||||||
|
|
||||||
|
if not inbound_messages:
|
||||||
|
inbound_number = inbound_number_client.get_inbound_sms_number_for_service(service_id)['data']['number']
|
||||||
|
else:
|
||||||
|
inbound_number = None
|
||||||
|
|
||||||
return {'messages': render_template(
|
return {'messages': render_template(
|
||||||
'views/dashboard/_inbox_messages.html',
|
'views/dashboard/_inbox_messages.html',
|
||||||
messages=messages_to_show,
|
messages=messages_to_show,
|
||||||
count_of_messages=len(inbound_messages),
|
count_of_messages=len(inbound_messages),
|
||||||
count_of_users=len(messages_to_show),
|
count_of_users=len(messages_to_show),
|
||||||
|
inbound_number=inbound_number,
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
messages,
|
messages,
|
||||||
caption="Inbox",
|
caption="Inbox",
|
||||||
caption_visible=False,
|
caption_visible=False,
|
||||||
empty_message='When users text your service’s phone number ({}) you’ll see the messages here'.format(current_service.sms_sender),
|
empty_message='When users text your service’s phone number ({}) you’ll see the messages here'.format(inbound_number),
|
||||||
field_headings=[
|
field_headings=[
|
||||||
'From',
|
'From',
|
||||||
'First two lines of message'
|
'First two lines of message'
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ def test_empty_inbox(
|
|||||||
mock_get_template_statistics,
|
mock_get_template_statistics,
|
||||||
mock_get_usage,
|
mock_get_usage,
|
||||||
mock_get_inbound_sms_with_no_messages,
|
mock_get_inbound_sms_with_no_messages,
|
||||||
|
mock_get_inbound_number_for_service,
|
||||||
):
|
):
|
||||||
|
|
||||||
service_one['permissions'] = ['inbound_sms']
|
service_one['permissions'] = ['inbound_sms']
|
||||||
@@ -185,7 +186,7 @@ def test_empty_inbox(
|
|||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert normalize_spaces(page.select('tbody tr')) == (
|
assert normalize_spaces(page.select('tbody tr')) == (
|
||||||
'When users text your service’s phone number (GOVUK) you’ll see the messages here'
|
'When users text your service’s phone number (0781239871) you’ll see the messages here'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -210,6 +211,7 @@ def test_anyone_can_see_inbox(
|
|||||||
service_one,
|
service_one,
|
||||||
mocker,
|
mocker,
|
||||||
mock_get_inbound_sms_with_no_messages,
|
mock_get_inbound_sms_with_no_messages,
|
||||||
|
mock_get_inbound_number_for_service,
|
||||||
):
|
):
|
||||||
|
|
||||||
service_one['permissions'] = ['inbound_sms']
|
service_one['permissions'] = ['inbound_sms']
|
||||||
|
|||||||
Reference in New Issue
Block a user