disapprovals: fix searching by user.

Fix searching post disapprovals by user to use the new `visible_for_search`
mechanism. This fixes it so you can do subsearches on the user field, like this:

* https://danbooru.donmai.us/post_disapprovals?search[user][level]=32 (find disapprovals by Builder-level approvers)
This commit is contained in:
evazion
2022-09-23 20:51:25 -05:00
parent 9363658652
commit 7bf824f0dd
3 changed files with 15 additions and 22 deletions

View File

@@ -1209,7 +1209,7 @@ class Post < ApplicationRecord
where(disapprovals: PostDisapproval.where(reason: query.downcase))
else
user = User.find_by_name(query)
where(disapprovals: PostDisapproval.creator_matches(user, current_user))
where(disapprovals: PostDisapproval.visible_for_search(:user, current_user).where(user: user))
end
end