diff --git a/Changelog.md b/Changelog.md index 8dbcbed6e..958139e97 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ ## Refactor * Remove title from profile photo upload button [#7551](https://github.com/diaspora/diaspora/pull/7551) +* Remove Internet Explorer workarounds [#7557](https://github.com/diaspora/diaspora/pull/7557) ## Bug fixes diff --git a/config.ru b/config.ru index 44a140077..a43a2f394 100644 --- a/config.ru +++ b/config.ru @@ -5,7 +5,6 @@ # This file is used by Rack-based servers to start the application. require ::File.expand_path("../config/environment", __FILE__) -require ::File.expand_path("../lib/rack/internet_explorer_version", __FILE__) # Kill unicorn workers really aggressively (at 300mb) if defined?(Unicorn) @@ -16,6 +15,5 @@ if defined?(Unicorn) use Unicorn::WorkerKiller::Oom, oom_min, oom_max end use Rack::Deflater -use Rack::InternetExplorerVersion, minimum: 9 run Diaspora::Application diff --git a/lib/rack/internet_explorer_version.rb b/lib/rack/internet_explorer_version.rb deleted file mode 100644 index 4d3b44468..000000000 --- a/lib/rack/internet_explorer_version.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -module Rack - class InternetExplorerVersion - def initialize(app, options={}) - @app = app - @options = options - end - - def call(env) - if env["HTTP_USER_AGENT"] =~ /MSIE/ && ie_version(env["HTTP_USER_AGENT"]) < @options[:minimum] - html = <<-HTML - - - - - Diaspora doesn't support your version of Internet Explorer. Try Firefox, Chrome or Opera! - - -

Diaspora doesn't support your version of Internet Explorer.

- You can use one of these browsers (and many more): - - - - HTML - return [200, {"Content-Type" => "text/html", "Content-Length" => html.size.to_s}, Rack::Response.new([html])] - end - @app.call(env) - end - - def ie_version(ua_string) - ua_string.match(/MSIE ?(\S+)/)[1].to_f - end - end -end diff --git a/spec/lib/rack/internet_explorer_version_spec.rb b/spec/lib/rack/internet_explorer_version_spec.rb deleted file mode 100644 index 78781cb25..000000000 --- a/spec/lib/rack/internet_explorer_version_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -describe Rack::InternetExplorerVersion do - before :all do - @app = Rack::Builder.parse_file(Rails.root.join("config.ru").to_s).first - end - - subject { get_response_for_user_agent(@app, ua_string) } - - context "non-IE browser" do - let(:ua_string) { "another browser chromeframe" } - - it "shouldn't complain about the browser" do - expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/) - end - end - - context "new IE" do - let(:ua_string) { "MSIE 9" } - - it "shouldn't complain about the browser" do - expect(subject.body).not_to match(/Diaspora doesn't support your version of Internet Explorer/) - end - end - - context "old IE" do - let(:ua_string) { "MSIE 7" } - - it "should complain about the browser" do - expect(subject.body).to match(/Diaspora doesn't support your version of Internet Explorer/) - end - - it "should have the correct content-length header" do - expect(subject.headers["Content-Length"]).to eq(subject.body.length.to_s) - end - end - - context "Specific case with no space after MSIE" do - let(:ua_string) { "Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.0) .NET CLR 2.0.50727" } - - it "should complain about the browser" do - expect(subject.body).to match(/Diaspora doesn't support your version of Internet Explorer/) - end - end -end