about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-22 21:38:47 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-22 21:38:47 +0100
commit12559b01eae408c0f3e820ef9c6bc6e356ab889a (patch)
tree87d857393ce24b1937c654ce7252b6315b7e77f9 /app/controllers
parent02e4fb2e06f424c16ab25ea294a4af6490a5f7e3 (diff)
Add pagination by max_id instead of offset/limit
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/accounts_controller.rb2
-rw-r--r--app/controllers/api/statuses_controller.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/api/accounts_controller.rb b/app/controllers/api/accounts_controller.rb
index f543ea98d..5bac98f81 100644
--- a/app/controllers/api/accounts_controller.rb
+++ b/app/controllers/api/accounts_controller.rb
@@ -15,7 +15,7 @@ class Api::AccountsController < ApiController
   end
 
   def statuses
-    @statuses = @account.statuses.with_includes.with_counters.order('created_at desc')
+    @statuses = @account.statuses.with_includes.with_counters.paginate_by_max_id(20, params[:max_id])
   end
 
   def follow
diff --git a/app/controllers/api/statuses_controller.rb b/app/controllers/api/statuses_controller.rb
index 951f7113a..ba216a7b3 100644
--- a/app/controllers/api/statuses_controller.rb
+++ b/app/controllers/api/statuses_controller.rb
@@ -23,11 +23,11 @@ class Api::StatusesController < ApiController
 
   def home
     feed      = Feed.new(:home, current_user.account)
-    @statuses = feed.get(20, (params[:offset] || 0).to_i)
+    @statuses = feed.get(20, params[:max_id] || '+inf')
   end
 
   def mentions
     feed      = Feed.new(:mentions, current_user.account)
-    @statuses = feed.get(20, (params[:offset] || 0).to_i)
+    @statuses = feed.get(20, params[:max_id] || '+inf')
   end
 end