Don’t show pagination links when searching

The search form makes a post request, so that phone numbers and email
addresses don’t show up in logs or browser history.

At most the API will return 50 results, with some pagination links. We
can’t easily give you links to click in the admin app, because links can
only perform get requests.

Because the value of seeing more than 50 results feels quite low (users
will probably make their search more specific before scrolling through
all 50) let’s just show a message saying only the first 50 results are
displayed.
This commit is contained in:
Chris Hill-Scott
2020-05-06 14:30:32 +01:00
parent 0955060c20
commit f30187b529
3 changed files with 39 additions and 2 deletions

View File

@@ -211,6 +211,7 @@ def get_notifications(service_id, message_type, status_override=None):
filter_args = parse_filter_args(request.args)
filter_args['status'] = set_status_filters(filter_args)
service_data_retention_days = None
search_term = request.form.get('to', '')
if message_type is not None:
service_data_retention_days = current_service.get_days_of_retention(message_type)
@@ -235,7 +236,7 @@ def get_notifications(service_id, message_type, status_override=None):
template_type=[message_type] if message_type else [],
status=filter_args.get('status'),
limit_days=service_data_retention_days,
to=request.form.get('to', ''),
to=search_term,
)
url_args = {
'message_type': message_type,
@@ -284,6 +285,7 @@ def get_notifications(service_id, message_type, status_override=None):
limit_days=service_data_retention_days,
prev_page=prev_page,
next_page=next_page,
more_than_can_be_shown=(next_page and search_term),
status=request.args.get('status'),
message_type=message_type,
download_link=download_link,

View File

@@ -33,6 +33,12 @@
</div>
{% endif %}
{{ previous_next_navigation(prev_page, next_page) }}
{% if more_than_can_be_shown %}
<p class="table-show-more-link">
Only showing the first 50 messages
</p>
{% else %}
{{ previous_next_navigation(prev_page, next_page) }}
{% endif %}
</div>