Add: 検索許可「ローカルとフォロワー」 (#60)
This commit is contained in:
parent
deb8642e95
commit
235bef36d0
24 changed files with 210 additions and 25 deletions
|
@ -89,10 +89,10 @@ class SearchQueryTransformer < Parslet::Transform
|
|||
public_index,
|
||||
searchability_limited,
|
||||
]
|
||||
definition_should << searchability_public if %i(public).include?(@searchability)
|
||||
definition_should << searchability_private if %i(public unlisted private).include?(@searchability)
|
||||
definition_should << searchable_by_me if %i(public unlisted private direct).include?(@searchability)
|
||||
definition_should << self_posts if %i(public unlisted private direct).exclude?(@searchability)
|
||||
definition_should << searchability_public if %i(public public_unlisted).include?(@searchability)
|
||||
definition_should << searchability_private if %i(public public_unlisted unlisted private).include?(@searchability)
|
||||
definition_should << searchable_by_me if %i(public public_unlisted unlisted private direct).include?(@searchability)
|
||||
definition_should << self_posts if %i(public public_unlisted unlisted private direct).exclude?(@searchability)
|
||||
|
||||
{
|
||||
bool: {
|
||||
|
@ -199,8 +199,8 @@ class SearchQueryTransformer < Parslet::Transform
|
|||
def following_account_ids
|
||||
return @following_account_ids if defined?(@following_account_ids)
|
||||
|
||||
account_exists_sql = Account.where('accounts.id = follows.target_account_id').where(searchability: %w(public 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 private)).reorder(nil).select(1).to_sql
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue