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:
@@ -92,16 +92,12 @@ class Comment < ApplicationRecord
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = where("true")
|
||||
q = super
|
||||
|
||||
if params[:body_matches].present?
|
||||
q = q.body_matches(params[:body_matches])
|
||||
end
|
||||
|
||||
if params[:id].present?
|
||||
q = q.where("id in (?)", params[:id].split(",").map(&:to_i))
|
||||
end
|
||||
|
||||
if params[:post_id].present?
|
||||
q = q.where("post_id in (?)", params[:post_id].split(",").map(&:to_i))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user