Skip to content
Snippets Groups Projects
Commit ddc34feb authored by alpaca-tc's avatar alpaca-tc Committed by Eugen Rochko
Browse files

Optimize follower_accounts and following_accounts (#2820)

parent 3f5b994f
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......@@ -4,4 +4,4 @@
- else
= render partial: 'accounts/grid_card', collection: accounts, as: :account, cached: true
= paginate accounts
= paginate follows
......@@ -6,4 +6,4 @@
= render 'accounts/header', account: @account
= render 'accounts/follow_grid', accounts: @accounts
= render 'accounts/follow_grid', follows: @follows, accounts: @follows.map(&:account)
......@@ -6,4 +6,4 @@
= render 'accounts/header', account: @account
= render 'accounts/follow_grid', accounts: @accounts
= render 'accounts/follow_grid', follows: @follows, accounts: @follows.map(&:target_account)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment