Revert "application controller: fix errors in normalize_search."

This reverts commit 28a88cfa85.
This commit is contained in:
evazion
2019-08-14 01:46:43 -05:00
parent d0428da120
commit d657624a80
2 changed files with 3 additions and 10 deletions

View File

@@ -195,8 +195,8 @@ class ApplicationController < ActionController::Base
# /tags?search[name]=touhou&search[category]=&search[order]=
# => /tags?search[name]=touhou
def normalize_search
return unless request.get? && params[:action] == "index"
params[:search] = search_params
return unless request.get?
params[:search] ||= ActionController::Parameters.new
deep_reject_blank = lambda do |hash|
hash.reject { |k, v| v.blank? || (v.is_a?(Hash) && deep_reject_blank.call(v).blank?) }
@@ -210,9 +210,7 @@ class ApplicationController < ActionController::Base
end
def search_params
search_params = params.fetch(:search, {})
search_params = ActionController::Parameters.new unless search_params.is_a?(ActionController::Parameters)
search_params.permit!
params.fetch(:search, {}).permit!
end
def set_safe_mode

View File

@@ -35,10 +35,5 @@ class ApplicationControllerTest < ActionDispatch::IntegrationTest
assert_response 410
end
end
should "normalize search params" do
get tags_path, params: { search: { name: "bkub", post_count: "" } }
assert_redirected_to tags_path(search: { name: "bkub" })
end
end
end