1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-11-24 15:16:26 +09:00

Optimize follower_accounts and following_accounts (#2820)

This commit is contained in:
alpaca-tc 2017-05-06 11:03:07 +09:00 committed by Eugen Rochko
parent 3f5b994ff0
commit ddc34feb58
5 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -4,4 +4,4 @@
- else
= render partial: 'accounts/grid_card', collection: accounts, as: :account, cached: true
= paginate accounts
= paginate follows

View File

@ -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)

View File

@ -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)