searchable: refactor searchable_includes.
Pass searchable associations directly to search_attributes instead of defining them separately in searchable_includes.
This commit is contained in:
@@ -563,7 +563,14 @@ class User < ApplicationRecord
|
||||
params = params.dup
|
||||
params[:name_matches] = params.delete(:name) if params[:name].present?
|
||||
|
||||
q = search_attributes(params, :id, :created_at, :updated_at, :name, :level, :post_upload_count, :post_update_count, :note_update_count, :favorite_count)
|
||||
q = search_attributes(params,
|
||||
:id, :created_at, :updated_at, :name, :level, :post_upload_count,
|
||||
:post_update_count, :note_update_count, :favorite_count, :posts,
|
||||
:note_versions, :artist_commentary_versions, :post_appeals,
|
||||
:post_approvals, :artist_versions, :comments, :wiki_page_versions,
|
||||
:feedback, :forum_topics, :forum_posts, :forum_post_votes,
|
||||
:tag_aliases, :tag_implications, :bans, :inviter
|
||||
)
|
||||
|
||||
if params[:name_matches].present?
|
||||
q = q.where_ilike(:name, normalize_name(params[:name_matches]))
|
||||
@@ -631,10 +638,6 @@ class User < ApplicationRecord
|
||||
"<@#{name}>"
|
||||
end
|
||||
|
||||
def self.searchable_includes
|
||||
[:posts, :note_versions, :artist_commentary_versions, :post_appeals, :post_approvals, :artist_versions, :comments, :wiki_page_versions, :feedback, :forum_topics, :forum_posts, :forum_post_votes, :tag_aliases, :tag_implications, :bans, :inviter]
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
[:inviter]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user