From 4bb14e2a622136e8093c68bddb4f7e5f8af7865b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 5 Nov 2018 20:44:55 +0100 Subject: [PATCH] Upgrade to Rails 5.2 --- Gemfile | 5 +- Gemfile.lock | 119 +++++++++--------- app/helpers/hide_sections_helper.rb | 4 +- app/models/concerns/virtual_attribute.rb | 4 +- app/views/boards/show.html.erb | 4 +- app/views/layouts/angular.html.erb | 4 +- app/views/my/page_layout.html.erb | 4 +- app/views/timelog/index.html.erb | 4 +- bin/bundle | 2 +- bin/rails | 2 +- config/application.rb | 2 +- config/boot.rb | 18 +-- config/environment.rb | 2 +- config/environments/development.rb | 14 ++- config/environments/production.rb | 23 +++- config/initializers/30-redmine.rb | 1 - .../initializers/active_record_query_trace.rb | 5 - .../application_controller_renderer.rb | 8 ++ config/initializers/callback_terminator.rb | 38 ------ .../initializers/content_security_policy.rb | 25 ++++ config/initializers/cookies_serializer.rb | 5 + .../new_framework_defaults_5_2.rb | 38 ++++++ config/storage.yml | 34 +++++ ...000000000_to_v710_aggregated_migrations.rb | 2 +- frontend/doc/LEGACY.md | 4 +- lib/chili_project.rb | 50 -------- .../plugin/templates/%full_name%.gemspec.tt | 2 - .../openproject-auth_plugins.gemspec | 1 - .../avatars/openproject-local_avatars.gemspec | 1 - .../openproject-github_integration.gemspec | 2 - .../openproject-openid_connect.gemspec | 1 - .../reporting_engine/reporting_engine.gemspec | 1 - ...nproject-two_factor_authentication.gemspec | 1 - modules/webhooks/openproject-webhooks.gemspec | 3 - 34 files changed, 232 insertions(+), 201 deletions(-) delete mode 100644 config/initializers/active_record_query_trace.rb create mode 100644 config/initializers/application_controller_renderer.rb delete mode 100644 config/initializers/callback_terminator.rb create mode 100644 config/initializers/content_security_policy.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/new_framework_defaults_5_2.rb create mode 100644 config/storage.yml delete mode 100644 lib/chili_project.rb diff --git a/Gemfile b/Gemfile index 26190991318..672421b9b7a 100644 --- a/Gemfile +++ b/Gemfile @@ -33,8 +33,9 @@ ruby '~> 2.5.1' gem 'actionpack-xml_parser', '~> 2.0.0' gem 'activemodel-serializers-xml', '~> 1.0.1' gem 'activerecord-session_store', '~> 1.1.0' -gem 'rails', '~> 5.1.6' +gem 'rails', '~> 5.2.1' gem 'responders', '~> 2.4' +gem "listen", "~> 3.1" # Use for event-based reloaders gem 'rubytree', git: 'https://github.com/dr0verride/RubyTree.git', ref: '06f53ee' gem 'rdoc', '>= 2.4.2' @@ -118,7 +119,7 @@ gem 'rack-protection', '~> 2.0.0' gem 'rack-attack', '~> 5.2.0' # CSP headers -gem 'secure_headers', '~> 5.0.5' +gem 'secure_headers', '~> 6.0.0' # Providing health checks gem 'okcomputer', '~> 1.16.0' diff --git a/Gemfile.lock b/Gemfile.lock index 9862bff9e05..1a08c1e1757 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,7 +80,6 @@ PATH specs: openproject-auth_plugins (8.2.0) omniauth (~> 1.0) - rails (~> 5.0) PATH remote: modules/avatars @@ -88,7 +87,6 @@ PATH openproject-avatars (8.2.0) fastimage (~> 2.1.0) gravatar_image_tag (~> 1.2.0) - rails (~> 5.0) PATH remote: modules/backlogs @@ -112,7 +110,6 @@ PATH specs: openproject-github_integration (8.2.0) openproject-webhooks - rails (~> 5.0) PATH remote: modules/global_roles @@ -137,7 +134,6 @@ PATH lobby_boy (~> 0.1.3) omniauth-openid_connect-providers (~> 0.1) openproject-auth_plugins (~> 8.0) - rails (~> 5.0) PATH remote: modules/pdf_export @@ -151,7 +147,6 @@ PATH specs: reporting_engine (8.2.0) json - rails (~> 5.1.0) PATH remote: modules/reporting @@ -167,14 +162,12 @@ PATH openproject-two_factor_authentication (8.2.0) aws-sdk-sns (~> 1.1.0) messagebird-rest (~> 1.3.2) - rails (~> 5) rotp (~> 3.3) PATH remote: modules/webhooks specs: openproject-webhooks (8.2.0) - rails (~> 5.0) PATH remote: modules/xls_export @@ -186,19 +179,19 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (1.0.3) - actioncable (5.1.6.1) - actionpack (= 5.1.6.1) + actioncable (5.2.1) + actionpack (= 5.2.1) nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.6.1) - actionpack (= 5.1.6.1) - actionview (= 5.1.6.1) - activejob (= 5.1.6.1) + websocket-driver (>= 0.6.1) + actionmailer (5.2.1) + actionpack (= 5.2.1) + actionview (= 5.2.1) + activejob (= 5.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.6.1) - actionview (= 5.1.6.1) - activesupport (= 5.1.6.1) + actionpack (5.2.1) + actionview (= 5.2.1) + activesupport (= 5.2.1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) @@ -206,34 +199,38 @@ GEM actionpack-xml_parser (2.0.1) actionpack (>= 5.0) railties (>= 5.0) - actionview (5.1.6.1) - activesupport (= 5.1.6.1) + actionview (5.2.1) + activesupport (= 5.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) active_record_query_trace (1.5.4) - activejob (5.1.6.1) - activesupport (= 5.1.6.1) + activejob (5.2.1) + activesupport (= 5.2.1) globalid (>= 0.3.6) - activemodel (5.1.6.1) - activesupport (= 5.1.6.1) + activemodel (5.2.1) + activesupport (= 5.2.1) activemodel-serializers-xml (1.0.1) activemodel (> 5.x) activerecord (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (5.1.6.1) - activemodel (= 5.1.6.1) - activesupport (= 5.1.6.1) - arel (~> 8.0) + activerecord (5.2.1) + activemodel (= 5.2.1) + activesupport (= 5.2.1) + arel (>= 9.0) activerecord-session_store (1.1.1) actionpack (>= 4.0) activerecord (>= 4.0) multi_json (~> 1.11, >= 1.11.2) rack (>= 1.5.2, < 3) railties (>= 4.0) - activesupport (5.1.6.1) + activestorage (5.2.1) + actionpack (= 5.2.1) + activerecord (= 5.2.1) + marcel (~> 0.3.1) + activesupport (5.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -252,13 +249,13 @@ GEM airbrake-ruby (1.5.0) archive-zip (0.11.0) io-like (~> 0.3.0) - arel (8.0.0) + arel (9.0.0) ast (2.4.0) attr_required (1.0.1) autoprefixer-rails (7.1.5) execjs - awesome_nested_set (3.1.3) - activerecord (>= 4.0.0, < 5.2) + awesome_nested_set (3.1.4) + activerecord (>= 4.0.0, < 5.3) aws-partitions (1.82.0) aws-sdk-core (3.20.2) aws-partitions (~> 1.0) @@ -364,10 +361,10 @@ GEM declarative-builder (0.1.0) declarative-option (< 0.2.0) declarative-option (0.1.0) - delayed_job (4.1.4) - activesupport (>= 3.0, < 5.2) - delayed_job_active_record (4.1.2) - activerecord (>= 3.0, < 5.2) + delayed_job (4.1.5) + activesupport (>= 3.0, < 5.3) + delayed_job_active_record (4.1.3) + activerecord (>= 3.0, < 5.3) delayed_job (>= 3.0, < 5) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) @@ -415,7 +412,7 @@ GEM fog-core nokogiri (~> 1.5, >= 1.5.11) formatador (0.2.5) - friendly_id (5.2.3) + friendly_id (5.2.4) activerecord (>= 4.0.0) fuubar (2.3.1) rspec-core (~> 3.0) @@ -474,6 +471,10 @@ GEM addressable (~> 2.3) letter_opener (1.4.1) launchy (~> 2.2) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) livingstyleguide (2.0.2) minisyntax (>= 0.2.5) redcarpet @@ -489,14 +490,17 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) messagebird-rest (1.3.3) meta-tags (2.6.0) actionpack (>= 3.2.0, < 5.3) - method_source (0.9.2) + method_source (0.9.1) mime-types (3.2.2) mime-types-data (~> 3.2015) mime-types-data (3.2018.0812) - mini_mime (1.0.1) + mimemagic (0.3.2) + mini_mime (1.0.0) mini_portile2 (2.3.0) minisyntax (0.2.5) minitest (5.11.3) @@ -598,17 +602,18 @@ GEM rack_session_access (0.2.0) builder (>= 2.0.0) rack (>= 1.0.0) - rails (5.1.6.1) - actioncable (= 5.1.6.1) - actionmailer (= 5.1.6.1) - actionpack (= 5.1.6.1) - actionview (= 5.1.6.1) - activejob (= 5.1.6.1) - activemodel (= 5.1.6.1) - activerecord (= 5.1.6.1) - activesupport (= 5.1.6.1) + rails (5.2.1) + actioncable (= 5.2.1) + actionmailer (= 5.2.1) + actionpack (= 5.2.1) + actionview (= 5.2.1) + activejob (= 5.2.1) + activemodel (= 5.2.1) + activerecord (= 5.2.1) + activestorage (= 5.2.1) + activesupport (= 5.2.1) bundler (>= 1.3.0) - railties (= 5.1.6.1) + railties (= 5.2.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) @@ -624,12 +629,12 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.1.6.1) - actionpack (= 5.1.6.1) - activesupport (= 5.1.6.1) + railties (5.2.1) + actionpack (= 5.2.1) + activesupport (= 5.2.1) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) rainbow (3.0.0) raindrops (0.19.0) rake (12.3.1) @@ -708,6 +713,7 @@ GEM ruby-rc4 (0.1.5) ruby-saml (1.9.0) nokogiri (>= 1.5.10) + ruby_dep (1.5.0) rubyzip (1.2.2) safe_yaml (1.0.4) sanitize (4.6.4) @@ -725,7 +731,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - secure_headers (5.0.5) + secure_headers (6.0.0) useragent (>= 0.15.0) selenium-webdriver (3.141.0) childprocess (~> 0.5) @@ -807,7 +813,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - websocket-driver (0.6.5) + websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) will_paginate (3.1.6) @@ -865,6 +871,7 @@ DEPENDENCIES json_spec (~> 1.1.4) launchy (~> 2.4.3) letter_opener + listen (~> 3.1) livingstyleguide (~> 2.0.1) meta-tags (~> 2.6.0) multi_json (~> 1.12.1) @@ -912,7 +919,7 @@ DEPENDENCIES rack-protection (~> 2.0.0) rack-test (~> 1.0.0) rack_session_access - rails (~> 5.1.6) + rails (~> 5.2.1) rails-controller-testing (~> 1.0.2) rails_12factor rdoc (>= 2.4.2) @@ -940,7 +947,7 @@ DEPENDENCIES sanitize (~> 4.6.0) sass (= 3.5.1) sass-rails (~> 5.0.6) - secure_headers (~> 5.0.5) + secure_headers (~> 6.0.0) selenium-webdriver (~> 3.14) semantic (~> 1.6.1) shoulda-context (~> 1.2) diff --git a/app/helpers/hide_sections_helper.rb b/app/helpers/hide_sections_helper.rb index f76dd75e007..4329db7b492 100644 --- a/app/helpers/hide_sections_helper.rb +++ b/app/helpers/hide_sections_helper.rb @@ -37,6 +37,8 @@ module HideSectionsHelper } ) - include_gon(nonce: content_security_policy_script_nonce, camel_case: true, camel_depth: 15) + nonced_javascript_tag do + include_gon(need_tag: false, nonce: content_security_policy_script_nonce, camel_case: true, camel_depth: 15) + end end end diff --git a/app/models/concerns/virtual_attribute.rb b/app/models/concerns/virtual_attribute.rb index 57cafe5a78a..5cfb9b15493 100644 --- a/app/models/concerns/virtual_attribute.rb +++ b/app/models/concerns/virtual_attribute.rb @@ -91,12 +91,12 @@ module Concerns # Using attribute_will_change! does not place the value in the tracker but merely forces # the attribute to be returned when asking the object for changes. def set_virtual_attribute_was(attribute, value) - attributes = mutation_tracker.send(:attributes) + attributes = mutations_from_database.send(:attributes) attributes[attribute.to_s].instance_variable_set(:@value_before_type_cast, value) end def set_virtual_attribute(attribute, value) - attributes = mutation_tracker.send(:attributes) + attributes = mutations_from_database.send(:attributes) attributes[attribute.to_s] = attributes[attribute.to_s].with_value_from_user(value) end end diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 94a89e175f2..6d7bcfe9086 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -27,7 +27,9 @@ See docs/COPYRIGHT.rdoc for more details. ++#%> -<%= include_gon(nonce: content_security_policy_nonce(:script)) %> +<%= nonced_javascript_tag do %> + <%= include_gon(need_tag: false) -%> +<% end %>