about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authoralpaca-tc <alpaca-tc@alpaca.tc>2017-05-06 11:03:07 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-06 04:03:07 +0200
commitddc34feb5875fd247fc7331b7710406d6de4a143 (patch)
tree5a1b654b9974ac1a5549bed6faa7abe8d92c4dfc /app/controllers
parent3f5b994ff0674fa8e0e5676ca22f0c347f9d7712 (diff)
Optimize follower_accounts and following_accounts (#2820)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/follower_accounts_controller.rb2
-rw-r--r--app/controllers/following_accounts_controller.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/follower_accounts_controller.rb b/app/controllers/follower_accounts_controller.rb
index 25c7a893a..d56bd2a4d 100644
--- a/app/controllers/follower_accounts_controller.rb
+++ b/app/controllers/follower_accounts_controller.rb
@@ -4,6 +4,6 @@ class FollowerAccountsController < ApplicationController
   include AccountControllerConcern
 
   def index
-    @accounts = @account.followers.page(params[:page]).per(FOLLOW_PER_PAGE)
+    @follows = Follow.where(target_account: @account).order(id: :desc).page(params[:page]).per(FOLLOW_PER_PAGE).preload(:account)
   end
 end
diff --git a/app/controllers/following_accounts_controller.rb b/app/controllers/following_accounts_controller.rb
index 0a8062680..925647864 100644
--- a/app/controllers/following_accounts_controller.rb
+++ b/app/controllers/following_accounts_controller.rb
@@ -4,6 +4,6 @@ class FollowingAccountsController < ApplicationController
   include AccountControllerConcern
 
   def index
-    @accounts = @account.following.page(params[:page]).per(FOLLOW_PER_PAGE)
+    @follows = Follow.where(account: @account).order(id: :desc).page(params[:page]).per(FOLLOW_PER_PAGE).preload(:target_account)
   end
 end