mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
BUGFIX: anon cache was mucking with params
This commit is contained in:
parent
1b8a32ba19
commit
adc9a58f4a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user