Skip to content

Commit

Permalink
BUGFIX: anon cache was mucking with params
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jan 9, 2014
1 parent 1b8a32b commit adc9a58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 0 additions & 3 deletions config/initializers/99-anon-cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
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
Expand Down
4 changes: 3 additions & 1 deletion lib/middleware/anonymous_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def is_mobile?
@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
Expand Down

0 comments on commit adc9a58

Please sign in to comment.