Model#search: factor out username search.

This commit is contained in:
evazion
2019-08-19 17:58:23 -05:00
parent 9a3e9747d8
commit c3ad7f6112
26 changed files with 41 additions and 189 deletions

View File

@@ -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?