diff --git a/app/service/rest.py b/app/service/rest.py index 385dfeb8b..0aae0534b 100644 --- a/app/service/rest.py +++ b/app/service/rest.py @@ -150,7 +150,6 @@ from app.utils import ( DATETIME_FORMAT_NO_TIMEZONE, get_prev_next_pagination_links, midnight_n_days_ago, - pagination_links, ) service_blueprint = Blueprint('service', __name__) @@ -533,11 +532,9 @@ def search_for_notification_by_to_field(service_id, search_term, statuses, notif ) return jsonify( notifications=notification_with_template_schema.dump(results.items, many=True).data, - # TODO: this may be a bug to include the pagination links as currently `search_for_notification_by_to_field` - # hardcodes the pages of results to always be the first page so not sure what benefit is to show a link to - # page 2 which would have the page parameter ignored - links=pagination_links( - results, + links=get_prev_next_pagination_links( + 1, + results.has_next, '.get_all_notifications_for_service', statuses=statuses, notification_type=notification_type, diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index 0b7b8322c..c8c79a765 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -2266,7 +2266,6 @@ def test_search_for_notification_by_to_field_returns_next_link_if_more_than_50( assert len(response_json['notifications']) == 50 assert 'prev' not in response_json['links'] assert 'page=2' in response_json['links']['next'] - assert 'page=2' in response_json['links']['last'] def test_search_for_notification_by_to_field_returns_no_next_link_if_50_or_less(