Merge branch 'next-minor' into develop

This commit is contained in:
Steffen van Bergerem 2017-08-24 14:57:59 +02:00
commit 974fbd4d03
No known key found for this signature in database
GPG key ID: 315C9787D548DC6B
8 changed files with 1 additions and 118 deletions

View file

@ -10,6 +10,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

View file

@ -1,6 +0,0 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
document.createElement('header');
document.createElement('footer');
// @license-end

View file

@ -50,21 +50,6 @@ module LayoutHelper
stylesheet_link_tag "#{current_color_theme}/#{view}", media: "all"
end
def old_browser_js_support
nonced_javascript_tag do
<<-JS.html_safe
if(Array.isArray === undefined) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) == '[object Array]';
};
}
if ((window.history) && (window.history.pushState === undefined)) {
window.history.pushState = function() { };
}
JS
end
end
def flash_messages
flash.map do |name, msg|
klass = flash_class name

View file

@ -8,12 +8,6 @@
%meta{name: "viewport", content: "width=device-width, initial-scale=1"}/
- content_for :javascript do
= old_browser_js_support
<!--[if IE]>
= javascript_include_tag :ie
<![endif]-->
= javascript_include_tag :main, :templates
= load_javascript_locales

View file

@ -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

View file

@ -74,7 +74,6 @@ module Diaspora
# (application.js, application.css, and all non-JS/CSS in the app/assets are already added)
config.assets.precompile += %w[
contact-list.js
ie.js
jquery3.js
jquery_ujs.js
main.js

View file

@ -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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Diaspora doesn't support your version of Internet Explorer. Try Firefox, Chrome or Opera!</title>
</head>
<body>
<h1>Diaspora doesn't support your version of Internet Explorer.</h1>
You can use one of these browsers (and many more):
<ul>
<li><a href="https://www.mozilla.org/firefox/">Firefox</a></li>
<li><a href="https://www.google.com/chrome/">Chrome</a></li>
<li><a href="https://www.opera.com/">Opera</a></li>
</ul>
</body>
</html>
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

View file

@ -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