about summary refs log tree commit diff
path: root/app/controllers/api/v1/accounts_controller.rb
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-05-26 00:09:13 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-25 17:09:13 +0200
commitcf4fe6cab86384971d4b7bd634f48b0a462efd48 (patch)
treebb6caf911ab91eb1e65e0e4f33f8ad15df0e2a38 /app/controllers/api/v1/accounts_controller.rb
parent2241a15ee9a79a2206beba1d98857b85c138aaad (diff)
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)
Diffstat (limited to 'app/controllers/api/v1/accounts_controller.rb')
-rw-r--r--app/controllers/api/v1/accounts_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index d323522ff..bd6fb6a2a 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -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)