diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index e8b049b88..fe60ee2b6 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -169,8 +169,12 @@ def view_notifications(service_id, message_type=None): things_you_can_search_by={ 'email': ['email address'], 'sms': ['phone number'], - 'letter': [], - None: ['email address', 'phone number'], + # This should become ‘postal address’ not ‘first line…’ once + # we’ve finished populating normalised addresses + 'letter': ['first line of address', 'file name'], + # We say recipient here because combining all 3 types, plus + # reference gets too long for the hint text + None: ['recipient'], }.get(message_type) + { True: ['reference'], False: [], diff --git a/app/templates/views/notifications.html b/app/templates/views/notifications.html index 7c9bbabc0..b675555af 100644 --- a/app/templates/views/notifications.html +++ b/app/templates/views/notifications.html @@ -34,42 +34,39 @@ 'counts' ) }} - {% call form_wrapper( - action=url_for('.view_notifications', service_id=current_service.id, message_type=message_type), - class="govuk-grid-row" - ) %} -
-Download this report diff --git a/tests/app/main/views/test_activity.py b/tests/app/main/views/test_activity.py index d916cc915..c75aa90e3 100644 --- a/tests/app/main/views/test_activity.py +++ b/tests/app/main/views/test_activity.py @@ -362,7 +362,7 @@ def test_shows_message_when_no_notifications( ( {}, {}, - 'Search by email address or phone number', + 'Search by recipient', '', ), ( @@ -395,6 +395,16 @@ def test_shows_message_when_no_notifications( 'Search by email address', 'test@example.com', ), + ( + { + 'message_type': 'letter', + }, + { + 'to': 'Firstname Lastname', + }, + 'Search by first line of address or file name', + 'Firstname Lastname', + ), ]) def test_search_recipient_form( client_request, @@ -435,9 +445,10 @@ def test_search_recipient_form( @pytest.mark.parametrize('message_type, expected_search_box_label', [ - (None, 'Search by email address, phone number or reference'), + (None, 'Search by recipient or reference'), ('sms', 'Search by phone number or reference'), ('email', 'Search by email address or reference'), + ('letter', 'Search by first line of address, file name or reference'), ]) def test_api_users_are_told_they_can_search_by_reference_when_service_has_api_keys( client_request, @@ -459,9 +470,10 @@ def test_api_users_are_told_they_can_search_by_reference_when_service_has_api_ke @pytest.mark.parametrize('message_type, expected_search_box_label', [ - (None, 'Search by email address or phone number'), + (None, 'Search by recipient'), ('sms', 'Search by phone number'), ('email', 'Search by email address'), + ('letter', 'Search by first line of address or file name'), ]) def test_api_users_are_not_told_they_can_search_by_reference_when_service_has_no_api_keys( client_request, @@ -634,13 +646,13 @@ def test_redacts_templates_that_should_be_redacted( @pytest.mark.parametrize( - "message_type, tablist_visible, search_bar_visible", [ - ('email', True, True), - ('sms', True, True), - ('letter', False, False) + "message_type, tablist_visible", [ + ('email', True), + ('sms', True), + ('letter', False) ] ) -def test_big_numbers_and_search_dont_show_for_letters( +def test_big_numbers_dont_show_for_letters( client_request, service_one, mock_get_notifications, @@ -650,7 +662,6 @@ def test_big_numbers_and_search_dont_show_for_letters( mock_get_no_api_keys, message_type, tablist_visible, - search_bar_visible ): page = client_request.get( 'main.view_notifications', @@ -661,7 +672,7 @@ def test_big_numbers_and_search_dont_show_for_letters( ) assert (len(page.select("[role=tablist]")) > 0) == tablist_visible - assert (len(page.select("[type=search]")) > 0) == search_bar_visible + assert (len(page.select("[type=search]")) > 0) is True @freeze_time("2017-09-27 16:30:00.000000")