about summary refs log tree commit diff
path: root/app/controllers/api/v1/timelines
diff options
context:
space:
mode:
authortateisu <tateisu@gmail.com>2018-05-28 18:04:06 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-05-28 11:04:06 +0200
commitb87a1229c74aebec02cd08091f25613f6dff4428 (patch)
treebf5eaecfd544005cc46d7aa52ccb81c41ef5265a /app/controllers/api/v1/timelines
parentab36e0ef72a52e5cc184d63cda0fe411c8b4086a (diff)
optimize direct timeline (#7614)
* optimize direct timeline

* fix typo in class name

* change filter condition for direct timeline

* fix codestyle issue

* revoke index_accounts_not_silenced because direct timeline does not use it.

* revoke index_accounts_not_silenced because direct timeline does not use it.

* fix rspec test condition.

* fix rspec test condition.

* fix rspec test condition.

* revoke adding column and partial index

* (direct timeline) move merging logic to model

* fix pagination parameter

* add method arguments that switches return array of status or cache_ids

* fix order by

* returns ActiveRecord.Relation in default behavor

* fix codestyle issue
Diffstat (limited to 'app/controllers/api/v1/timelines')
-rw-r--r--app/controllers/api/v1/timelines/direct_controller.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/controllers/api/v1/timelines/direct_controller.rb b/app/controllers/api/v1/timelines/direct_controller.rb
index d455227eb..ef64078be 100644
--- a/app/controllers/api/v1/timelines/direct_controller.rb
+++ b/app/controllers/api/v1/timelines/direct_controller.rb
@@ -23,15 +23,18 @@ class Api::V1::Timelines::DirectController < Api::BaseController
   end
 
   def direct_statuses
-    direct_timeline_statuses.paginate_by_max_id(
-      limit_param(DEFAULT_STATUSES_LIMIT),
-      params[:max_id],
-      params[:since_id]
-    )
+    direct_timeline_statuses
   end
 
   def direct_timeline_statuses
-    Status.as_direct_timeline(current_account)
+    # this query requires built in pagination.
+    Status.as_direct_timeline(
+      current_account,
+      limit_param(DEFAULT_STATUSES_LIMIT),
+      params[:max_id],
+      params[:since_id],
+      true # returns array of cache_ids object
+    )
   end
 
   def insert_pagination_headers