BUGFIX: anon cache was mucking with params

This commit is contained in:
Sam 2014-01-09 16:49:12 +11:00
parent 1b8a32ba19
commit adc9a58f4a
2 changed files with 3 additions and 4 deletions

View File

@ -6,9 +6,6 @@ enabled = if Rails.configuration.respond_to?(:enable_anon_caching)
Rails.env.production?
end
# DISABLE to check if its killing the smoke test
enabled = false
if !ENV['DISCOURSE_DISABLE_ANON_CACHE'] && enabled
# in an ideal world this is position 0, but mobile detection uses ... session and request and params
Rails.configuration.middleware.insert_after ActionDispatch::ParamsParser, Middleware::AnonymousCache

View File

@ -20,7 +20,9 @@ module Middleware
@is_mobile ||=
begin
session = @env["rack.session"]
params = ActionDispatch::Request.new(@env).params
# don't initialize params until later otherwise
# you get a broken params on the request
params = {}
user_agent = @env["HTTP_USER_AGENT"]
MobileDetection.resolve_mobile_view!(user_agent,params,session) ? :true : :false