Model#search: factor out username search.
This commit is contained in:
@@ -55,12 +55,11 @@ class PostDisapproval < ApplicationRecord
|
||||
q = super
|
||||
|
||||
q = q.attribute_matches(:post_id, params[:post_id])
|
||||
q = q.attribute_matches(:user_id, params[:user_id])
|
||||
q = q.attribute_matches(:message, params[:message_matches])
|
||||
q = q.search_user_attribute(:user, params)
|
||||
q = q.search_text_attribute(:message, params)
|
||||
|
||||
q = q.post_tags_match(params[:post_tags_match]) if params[:post_tags_match].present?
|
||||
q = q.where(user_id: User.search(name_matches: params[:creator_name])) if params[:creator_name].present?
|
||||
q = q.where(reason: params[:reason]) if params[:reason].present?
|
||||
|
||||
q = q.with_message if params[:has_message].to_s.truthy?
|
||||
|
||||
Reference in New Issue
Block a user