Fix #3430: Accept the search[id] param in all controllers.

* Allow every controller to take the `search[id]` param.

* Parse the `search[id]` param the same way that the `id:<N>` metatag is
  parsed. So `search[id]=1,2,3`, `search[id]=<42`, `search[id]=1..10`, for
  example, are all accepted.
This commit is contained in:
evazion
2017-12-17 16:58:34 -06:00
parent 49577e3fac
commit 0ca726802f
28 changed files with 72 additions and 58 deletions

View File

@@ -89,7 +89,7 @@ class PostReplacement < ApplicationRecord
end
def search(params = {})
q = all
q = super
if params[:creator_id].present?
q = q.where(creator_id: params[:creator_id].split(",").map(&:to_i))
@@ -99,10 +99,6 @@ class PostReplacement < ApplicationRecord
q = q.where(creator_id: User.name_to_id(params[:creator_name]))
end
if params[:id].present?
q = q.where(id: params[:id].split(",").map(&:to_i))
end
if params[:post_id].present?
q = q.where(post_id: params[:post_id].split(",").map(&:to_i))
end