0
0
Fork 0

More use of next link header on account (media) timelines (#3311)

This will reduce requests on who have only few statuses.

- Use next link header to detect more items from first request
- Omit next link header if result items are fewer than requested count
(It had omit it only if result was empty before)
This commit is contained in:
unarist 2017-05-26 00:09:13 +09:00 committed by Eugen Rochko
parent 2241a15ee9
commit cf4fe6cab8
3 changed files with 16 additions and 12 deletions

View file

@ -62,7 +62,7 @@ class Api::V1::AccountsController < ApiController
set_maps(@statuses)
next_path = statuses_api_v1_account_url(statuses_pagination_params(max_id: @statuses.last.id)) unless @statuses.empty?
next_path = statuses_api_v1_account_url(statuses_pagination_params(max_id: @statuses.last.id)) if @statuses.size == limit_param(DEFAULT_STATUSES_LIMIT)
prev_path = statuses_api_v1_account_url(statuses_pagination_params(since_id: @statuses.first.id)) unless @statuses.empty?
set_pagination_headers(next_path, prev_path)