forked from e621ng/e621ng
[StaffNotes] Fix body searching (#654)
This commit is contained in:
parent
715ea9bddb
commit
4f61a94504
@ -6,8 +6,8 @@ module Admin
|
||||
respond_to :html
|
||||
|
||||
def index
|
||||
@user = User.where('id = ?', params[:user_id]).first
|
||||
@notes = StaffNote.search(search_params.merge({user_id: params[:user_id]})).includes(:user, :creator).paginate(params[:page])
|
||||
@user = User.find_by(id: params[:user_id])
|
||||
@notes = StaffNote.search(search_params.merge({ user_id: params[:user_id] })).includes(:user, :creator).paginate(params[:page], limit: params[:limit])
|
||||
respond_with(@notes)
|
||||
end
|
||||
|
||||
@ -30,8 +30,12 @@ module Admin
|
||||
|
||||
private
|
||||
|
||||
def search_params
|
||||
permit_search_params(%i[creator_id creator_name user_id user_name resolved body_matches without_system_user])
|
||||
end
|
||||
|
||||
def note_params
|
||||
params.fetch(:staff_note, {}).permit([:body])
|
||||
params.fetch(:staff_note, {}).permit(%i[body])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,10 +8,8 @@ class StaffNote < ApplicationRecord
|
||||
def search(params)
|
||||
q = super
|
||||
|
||||
if params[:resolved]
|
||||
q = q.attribute_matches(:resolved, params[:resolved])
|
||||
end
|
||||
|
||||
q = q.attribute_matches(:resolved, params[:resolved])
|
||||
q = q.attribute_matches(:body, params[:body_matches])
|
||||
q = q.where_user(:user_id, :user, params)
|
||||
q = q.where_user(:creator_id, :creator, params)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user