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

@@ -40,13 +40,12 @@ class PostApproval < ApplicationRecord
def search(params)
q = super
params[:user_id] = User.name_to_id(params[:user_name]) if params[:user_name]
if params[:post_tags_match].present?
q = q.post_tags_match(params[:post_tags_match])
end
q = q.attribute_matches(:user_id, params[:user_id])
q = q.search_user_attribute(:user, params)
q = q.attribute_matches(:post_id, params[:post_id])
q.apply_default_order(params)