mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Use private method to choose advanced sql template
This commit is contained in:
parent
8d1bf75cff
commit
a72d8a6132
@ -121,9 +121,7 @@ class AccountSearchQuery
|
||||
end
|
||||
|
||||
def advanced_search(account, following: false)
|
||||
sql_template = following ? ADVANCED_SEARCH_WITH_FOLLOWING : ADVANCED_SEARCH_WITHOUT_FOLLOWING
|
||||
|
||||
Account.find_by_sql([sql_template, { id: account.id, limit: @limit, offset: @offset, tsquery: generate_query_for_search }]).tap do |records|
|
||||
Account.find_by_sql([advanced_sql_template(following), { id: account.id, limit: @limit, offset: @offset, tsquery: generate_query_for_search }]).tap do |records|
|
||||
ActiveRecord::Associations::Preloader.new(records: records, associations: [:account_stat, { user: :role }]).call
|
||||
end
|
||||
end
|
||||
@ -143,4 +141,8 @@ class AccountSearchQuery
|
||||
@terms
|
||||
.gsub(DISALLOWED_TSQUERY_CHARACTERS, ' ')
|
||||
end
|
||||
|
||||
def advanced_sql_template(following)
|
||||
following ? ADVANCED_SEARCH_WITH_FOLLOWING : ADVANCED_SEARCH_WITHOUT_FOLLOWING
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user