Revert "#66 検索時のフォロー中アカウント一覧作成処理を改善"

This reverts commit 22d1f52597.
This commit is contained in:
KMY 2023-10-07 21:33:52 +09:00
parent 9738d80cb4
commit 87afb5295a
7 changed files with 5 additions and 90 deletions

View file

@ -199,7 +199,10 @@ class SearchQueryTransformer < Parslet::Transform
def following_account_ids
return @following_account_ids if defined?(@following_account_ids)
@following_account_ids = @options[:current_account].following.includes(:account_stat).where(account_stat: { searchable_by_follower: true }).select(:id).pluck(:id)
account_exists_sql = Account.where('accounts.id = follows.target_account_id').where(searchability: %w(public public_unlisted private)).reorder(nil).select(1).to_sql
status_exists_sql = Status.where('statuses.account_id = follows.target_account_id').where(reblog_of_id: nil).where(searchability: %w(public public_unlisted private)).reorder(nil).select(1).to_sql
following_accounts = Follow.where(account_id: @options[:current_account].id).merge(Account.where("EXISTS (#{account_exists_sql})").or(Account.where("EXISTS (#{status_exists_sql})")))
@following_account_ids = following_accounts.pluck(:target_account_id)
end
end