Merge pull request #5316 from gdpelican/feature/allow-nil-http-agent
Allow nil HTTP user agent
This commit is contained in:
commit
0a20d6a2b7
3 changed files with 9 additions and 1 deletions
|
|
@ -69,6 +69,7 @@ The keys will still be available in the root level within the 0.5 release. The o
|
|||
* Fix poll creation on Bootstrap pages [#5334](https://github.com/diaspora/diaspora/pull/5334)
|
||||
* Show error message on invalid reset password attempt [#5325](https://github.com/diaspora/diaspora/pull/5325)
|
||||
* Fix translations on mobile password reset pages [#5318](https://github.com/diaspora/diaspora/pull/5318)
|
||||
* Handle unset user agent when signing out [#5316](https://github.com/diaspora/diaspora/pull/5316)
|
||||
|
||||
## Features
|
||||
* Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ApplicationController < ActionController::Base
|
|||
def after_sign_out_path_for(resource_or_scope)
|
||||
# mobile_fu's is_mobile_device? wasn't working here for some reason...
|
||||
# it may have been just because of the test env.
|
||||
if request.env['HTTP_USER_AGENT'].match(/mobile/i)
|
||||
if request.env['HTTP_USER_AGENT'].try(:match, /mobile/i)
|
||||
root_path
|
||||
else
|
||||
new_user_session_path
|
||||
|
|
|
|||
|
|
@ -91,4 +91,11 @@ describe ApplicationController, :type => :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#after_sign_out_path_for" do
|
||||
it "can handle a nil HTTP_USER_AGENT" do
|
||||
@request.headers["HTTP_USER_AGENT"] = nil
|
||||
expect(@controller.send(:after_sign_out_path_for, alice)).to eq(new_user_session_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue