search: clean up safe_mode / hide_deleted_posts settings.
Change PostQueryBuilder to add rating:s and -status:deleted to the search inside the constructor instead of inside `#build` and `#fast_count`. This lets up clean up `#fast_count` so it doesn't have to reparse the query after adding these tags. This caused aliases to be evaluated more than once on the post index page.
This commit is contained in:
@@ -134,13 +134,13 @@ class SavedSearch < ApplicationRecord
|
||||
def queries_for(user_id, label: nil, options: {})
|
||||
searches = SavedSearch.where(user_id: user_id)
|
||||
searches = searches.labeled(label) if label.present?
|
||||
queries = searches.pluck(:query).map { |query| PostQueryBuilder.new(query).to_s }
|
||||
queries = searches.map(&:normalized_query)
|
||||
queries.sort.uniq
|
||||
end
|
||||
end
|
||||
|
||||
def normalized_query
|
||||
PostQueryBuilder.new(query, normalize_aliases: false).to_s
|
||||
PostQueryBuilder.new(query).to_s
|
||||
end
|
||||
|
||||
def normalize_query
|
||||
|
||||
Reference in New Issue
Block a user