From a354dd1afa969389f0b5e4158cc83a018ba0f891 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 5 Jan 2024 13:32:13 -0600 Subject: [PATCH 01/25] Update spring gem per rails upgrade guide --- Gemfile | 4 ++-- Gemfile.lock | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index d2465889..ddefe281 100644 --- a/Gemfile +++ b/Gemfile @@ -86,8 +86,8 @@ group :development do gem 'listen', '~> 3.5.1' gem 'rspec-rails', '~> 5.0.0' gem 'rubocop' - gem 'spring' - gem 'spring-watcher-listen', '~> 2.0.0' + gem 'spring', '~> 4.0.0' + gem 'spring-watcher-listen', '~> 2.1.0' gem 'web-console', '>= 3.3.0' # Use Capistrano for deployment diff --git a/Gemfile.lock b/Gemfile.lock index 21202447..7afff0b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -416,10 +416,10 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - spring (2.1.1) - spring-watcher-listen (2.0.1) + spring (4.0.0) + spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) + spring (>= 4) sprockets (4.2.0) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -537,8 +537,8 @@ DEPENDENCIES sass-rails (>= 5) selenium-webdriver simplecov - spring - spring-watcher-listen (~> 2.0.0) + spring (~> 4.0.0) + spring-watcher-listen (~> 2.1.0) sprockets-es6 terser (~> 1.1) trix From e58759b7bc9d817a862a40615685e40bbba1815d Mon Sep 17 00:00:00 2001 From: jseraf Date: Mon, 8 Jan 2024 16:01:19 -0600 Subject: [PATCH 02/25] WIP: dev/test gem updates, specs pass --- Gemfile | 28 ++++------ Gemfile.lock | 143 +++++++++++++++++++++++++-------------------------- 2 files changed, 81 insertions(+), 90 deletions(-) diff --git a/Gemfile b/Gemfile index ddefe281..cad5669f 100644 --- a/Gemfile +++ b/Gemfile @@ -26,9 +26,9 @@ gem 'requestjs-rails' gem 'turbo-rails', '~> 1.4.0' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false +gem 'bootsnap', '>= 1.17.0', require: false -gem 'devise', '>= 4.8.1' +gem 'devise', '4.9.3' gem 'devise_saml_authenticatable', '~> 1.9.0' gem 'draper' gem 'pundit' @@ -73,8 +73,9 @@ gem 'wkhtmltopdf-binary' group :development, :test do gem 'awesome_print' gem 'byebug', platforms: %i[mri mingw x64_mingw] - gem 'puma', '~> 4.3.12' - gem 'webrick', '1.7.0' + gem 'puma', '~> 5.6.8' + gem 'rspec-rails', '6.1' + gem 'webrick', '1.8.1' end group :development do @@ -84,7 +85,6 @@ group :development do gem 'bullet' gem 'i18n-debug' gem 'listen', '~> 3.5.1' - gem 'rspec-rails', '~> 5.0.0' gem 'rubocop' gem 'spring', '~> 4.0.0' gem 'spring-watcher-listen', '~> 2.1.0' @@ -99,21 +99,15 @@ group :development do end group :test do - gem 'capybara' + gem 'capybara', '~> 3.39.2' gem 'capybara-select-2' gem 'factory_bot_rails' - gem 'faker', git: 'https://github.com/stympy/faker.git', branch: 'master' - gem 'pundit-matchers', '~> 1.6.0' - gem 'rspec' + gem 'faker', '~> 3.2.2' + gem 'pundit-matchers', '~> 3.1.2' + gem 'rspec', '3.12.0' gem 'rails-controller-testing' - gem 'selenium-webdriver' - gem 'simplecov', require: false - - # gem 'rspec-rails', git: 'https://github.com/rspec/rspec-rails', branch: 'main' - # gem 'rspec-core', git: 'https://github.com/rspec/rspec-core', branch: 'main' - # gem 'rspec-expectations', git: 'https://github.com/rspec/rspec-expectations', branch: 'main' - # gem 'rspec-mocks', git: 'https://github.com/rspec/rspec-mocks', branch: 'main' - # gem 'rspec-support', git: 'https://github.com/rspec/rspec-support', branch: 'main' + gem 'selenium-webdriver', '~> 4.16.0' + gem 'simplecov', '~> 0.22', require: false end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index 7afff0b6..dfd1cde7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,14 +7,6 @@ GIT activesupport (>= 6.0.4) i18n -GIT - remote: https://github.com/stympy/faker.git - revision: b1f567bd8456dd720aa9c4bad32d4562f4a38a27 - branch: master - specs: - faker (2.20.0) - i18n (>= 1.8.11, < 2) - GEM remote: https://rubygems.org/ specs: @@ -81,8 +73,8 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) american_date (1.2.0) @@ -111,7 +103,7 @@ GEM babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) - bcrypt (3.1.18) + bcrypt (3.1.20) better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) @@ -119,7 +111,7 @@ GEM bindex (0.8.1) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bootsnap (1.11.1) + bootsnap (1.17.0) msgpack (~> 1.2) builder (3.2.4) bullet (7.0.1) @@ -143,7 +135,7 @@ GEM sshkit (~> 1.2) capistrano-service (0.0.2) capistrano (>= 3.0.0.pre) - capybara (3.36.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -161,14 +153,13 @@ GEM caxlsx_rails (0.6.3) actionpack (>= 3.1) caxlsx (>= 3.0) - childprocess (4.1.0) cocoon (1.2.15) coderay (1.1.3) concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3) debug_inspector (1.1.0) - devise (4.8.1) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -194,11 +185,13 @@ GEM actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) execjs (2.8.1) - factory_bot (6.2.1) + factory_bot (6.4.5) activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) + factory_bot_rails (6.4.3) + factory_bot (~> 6.4) railties (>= 5.0.0) + faker (3.2.2) + i18n (>= 1.8.11, < 2) ffi (1.15.5) font-awesome-rails (4.7.0.8) railties (>= 3.2, < 8.0) @@ -249,7 +242,7 @@ GEM listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -261,8 +254,8 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.19.0) - msgpack (1.5.1) + minitest (5.20.0) + msgpack (1.7.2) nested_form (0.3.2) net-imap (0.3.7) date @@ -276,12 +269,12 @@ GEM net-smtp (0.3.3) net-protocol net-ssh (6.1.0) - nio4r (2.5.9) - nokogiri (1.15.4-arm64-darwin) + nio4r (2.7.0) + nokogiri (1.16.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-darwin) + nokogiri (1.16.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) pagy (4.10.2) @@ -292,14 +285,17 @@ GEM parser (3.1.2.0) ast (~> 2.4.1) pg (1.3.5) - public_suffix (4.0.7) - puma (4.3.12) + public_suffix (5.0.4) + puma (5.6.8) nio4r (~> 2.0) pundit (2.2.0) activesupport (>= 3.0.0) - pundit-matchers (1.6.0) - rspec-rails (>= 3.0.0) - racc (1.7.1) + pundit-matchers (3.1.2) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + racc (1.7.3) rack (2.2.8) rack-test (2.1.0) rack (>= 1.3) @@ -336,41 +332,41 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) redis (4.6.0) - regexp_parser (2.3.0) + regexp_parser (2.9.0) request_store (1.5.1) rack (>= 1.4) requestjs-rails (0.0.10) rails (>= 6.0.0) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) - rexml (3.2.5) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-rails (5.0.3) + responders (3.1.1) actionpack (>= 5.2) - activesupport (>= 5.2) railties (>= 5.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.11.0) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-rails (6.1.0) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) rubocop (1.27.0) parallel (~> 1.10) parser (>= 3.1.0.0) @@ -405,12 +401,12 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.16.0) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) sexp_processor (4.16.1) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) @@ -439,7 +435,7 @@ GEM temple (0.8.2) terser (1.1.11) execjs (>= 0.3.0, < 3) - thor (1.2.2) + thor (1.3.0) tilt (2.0.10) timeliness (0.4.4) timeout (0.4.0) @@ -462,7 +458,8 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.7.0) + webrick (1.8.1) + websocket (1.2.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -471,7 +468,7 @@ GEM wkhtmltopdf-binary (0.12.6.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 @@ -486,7 +483,7 @@ DEPENDENCIES aws-sdk-s3 better_errors binding_of_caller - bootsnap (>= 1.1.0) + bootsnap (>= 1.17.0) bullet byebug capistrano @@ -494,18 +491,18 @@ DEPENDENCIES capistrano-rails capistrano-rvm capistrano-service - capybara + capybara (~> 3.39.2) capybara-select-2 caxlsx caxlsx_rails cocoon - devise (>= 4.8.1) + devise (= 4.9.3) devise_saml_authenticatable (~> 1.9.0) discard (~> 1.2) draper exception_notification factory_bot_rails - faker! + faker (~> 3.2.2) font-awesome-rails foundation-datepicker-rails foundation-rails (~> 6.5.3.0) @@ -522,21 +519,21 @@ DEPENDENCIES pagy (~> 4.10.1) paper_trail (= 11.1) pg - puma (~> 4.3.12) + puma (~> 5.6.8) pundit - pundit-matchers (~> 1.6.0) + pundit-matchers (~> 3.1.2) rails (= 6.1.7.6) rails-controller-testing ransack! redis (~> 4.0) requestjs-rails - rspec - rspec-rails (~> 5.0.0) + rspec (= 3.12.0) + rspec-rails (= 6.1) rubocop rubyzip (~> 2.3.0) sass-rails (>= 5) - selenium-webdriver - simplecov + selenium-webdriver (~> 4.16.0) + simplecov (~> 0.22) spring (~> 4.0.0) spring-watcher-listen (~> 2.1.0) sprockets-es6 @@ -546,7 +543,7 @@ DEPENDENCIES tzinfo-data validates_timeliness (= 6.0.0.alpha1) web-console (>= 3.3.0) - webrick (= 1.7.0) + webrick (= 1.8.1) wicked_pdf wkhtmltopdf-binary From d689b28dd50af9788d3a589d515a4b04fb579f76 Mon Sep 17 00:00:00 2001 From: jseraf Date: Mon, 8 Jan 2024 16:15:01 -0600 Subject: [PATCH 03/25] WIP: remove deprecated return_false_on_aborted_enqueue config as part of rails upgrade --- config/initializers/new_framework_defaults_6_0.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb index 22302457..4e92d679 100644 --- a/config/initializers/new_framework_defaults_6_0.rb +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -20,7 +20,7 @@ Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false # Return false instead of self when enqueuing is aborted from a callback. -Rails.application.config.active_job.return_false_on_aborted_enqueue = true +# Rails.application.config.active_job.return_false_on_aborted_enqueue = true # Send Active Storage analysis and purge jobs to dedicated queues. Rails.application.config.active_storage.queues.analysis = :active_storage_analysis From 62c9752159844ccf021321c7ce8ad0c00a5f7ee4 Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 9 Jan 2024 10:34:37 -0600 Subject: [PATCH 04/25] WIP: remove unused draper gem --- Gemfile | 1 - Gemfile.lock | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/Gemfile b/Gemfile index cad5669f..a893a582 100644 --- a/Gemfile +++ b/Gemfile @@ -30,7 +30,6 @@ gem 'bootsnap', '>= 1.17.0', require: false gem 'devise', '4.9.3' gem 'devise_saml_authenticatable', '~> 1.9.0' -gem 'draper' gem 'pundit' gem 'rubyzip', '~> 2.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index dfd1cde7..0d3c0981 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,10 +53,6 @@ GEM globalid (>= 0.3.6) activemodel (6.1.7.6) activesupport (= 6.1.7.6) - activemodel-serializers-xml (1.0.2) - activemodel (> 5.x) - activesupport (> 5.x) - builder (~> 3.1) activerecord (6.1.7.6) activemodel (= 6.1.7.6) activesupport (= 6.1.7.6) @@ -172,13 +168,6 @@ GEM discard (1.2.1) activerecord (>= 4.2, < 8) docile (1.4.0) - draper (4.0.2) - actionpack (>= 5.0) - activemodel (>= 5.0) - activemodel-serializers-xml (>= 1.0) - activesupport (>= 5.0) - request_store (>= 1.0) - ruby2_keywords erubi (1.12.0) erubis (2.7.0) exception_notification (4.5.0) @@ -382,7 +371,6 @@ GEM ruby-saml (1.14.0) nokogiri (>= 1.10.5) rexml - ruby2_keywords (0.0.5) ruby_parser (3.19.1) sexp_processor (~> 4.16) rubyzip (2.3.2) @@ -499,7 +487,6 @@ DEPENDENCIES devise (= 4.9.3) devise_saml_authenticatable (~> 1.9.0) discard (~> 1.2) - draper exception_notification factory_bot_rails faker (~> 3.2.2) From 4f72ff26fd9248a5c1ed8579e1d3ba89a2970420 Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 9 Jan 2024 11:30:00 -0600 Subject: [PATCH 05/25] WIP: more gem updates --- Gemfile | 10 +++++----- Gemfile.lock | 43 +++++++++++++++++-------------------------- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/Gemfile b/Gemfile index a893a582..fbf02e82 100644 --- a/Gemfile +++ b/Gemfile @@ -29,16 +29,16 @@ gem 'turbo-rails', '~> 1.4.0' gem 'bootsnap', '>= 1.17.0', require: false gem 'devise', '4.9.3' -gem 'devise_saml_authenticatable', '~> 1.9.0' -gem 'pundit' -gem 'rubyzip', '~> 2.3.0' +gem 'devise_saml_authenticatable', '~> 1.9.1' +gem 'pundit', '~> 2.3.1' +gem 'rubyzip', '~> 2.3.2' # frontend gem 'font-awesome-rails' gem 'foundation-rails', '~> 6.5.3.0' gem 'foundation-datepicker-rails' -gem 'friendly_id', '~> 5.4.0' -gem 'haml-rails', '~> 2.0.1' +gem 'friendly_id', '~> 5.5.0' +gem 'haml-rails', '~> 2.0' gem 'jquery-rails', '>= 4.3.5' gem 'jquery-ui-rails' gem 'pagy', '~> 4.10.1' diff --git a/Gemfile.lock b/Gemfile.lock index 0d3c0981..8ec6421a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -161,7 +161,7 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise_saml_authenticatable (1.9.0) + devise_saml_authenticatable (1.9.1) devise (> 2.0.0) ruby-saml (~> 1.7) diff-lcs (1.5.0) @@ -169,7 +169,6 @@ GEM activerecord (>= 4.2, < 8) docile (1.4.0) erubi (1.12.0) - erubis (2.7.0) exception_notification (4.5.0) actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) @@ -189,28 +188,23 @@ GEM railties (>= 3.1.0) sass (>= 3.3.0) sprockets-es6 (>= 0.9.0) - friendly_id (5.4.2) + friendly_id (5.5.1) activerecord (>= 4.0.0) globalid (1.1.0) activesupport (>= 5.0) - haml (5.2.2) - temple (>= 0.8.0) + haml (6.3.0) + temple (>= 0.8.2) + thor tilt - haml-rails (2.0.1) + haml-rails (2.1.0) actionpack (>= 5.1) activesupport (>= 5.1) - haml (>= 4.0.6, < 6.0) - html2haml (>= 1.0.1) + haml (>= 4.0.6) railties (>= 5.1) hotwire-rails (0.1.3) rails (>= 6.0.0) stimulus-rails turbo-rails - html2haml (2.2.0) - erubis (~> 2.7.0) - haml (>= 4.0, < 6) - nokogiri (>= 1.6.0) - ruby_parser (~> 3.5) htmlentities (4.3.4) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -277,7 +271,7 @@ GEM public_suffix (5.0.4) puma (5.6.8) nio4r (~> 2.0) - pundit (2.2.0) + pundit (2.3.1) activesupport (>= 3.0.0) pundit-matchers (3.1.2) rspec-core (~> 3.12) @@ -368,11 +362,9 @@ GEM rubocop-ast (1.17.0) parser (>= 3.1.1.0) ruby-progressbar (1.11.0) - ruby-saml (1.14.0) - nokogiri (>= 1.10.5) + ruby-saml (1.16.0) + nokogiri (>= 1.13.10) rexml - ruby_parser (3.19.1) - sexp_processor (~> 4.16) rubyzip (2.3.2) sass (3.7.4) sass-listen (~> 4.0.0) @@ -393,7 +385,6 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sexp_processor (4.16.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -420,11 +411,11 @@ GEM net-ssh (>= 2.8.0) stimulus-rails (1.0.4) railties (>= 6.0.0) - temple (0.8.2) + temple (0.10.3) terser (1.1.11) execjs (>= 0.3.0, < 3) thor (1.3.0) - tilt (2.0.10) + tilt (2.3.0) timeliness (0.4.4) timeout (0.4.0) trix (0.10.1) @@ -485,7 +476,7 @@ DEPENDENCIES caxlsx_rails cocoon devise (= 4.9.3) - devise_saml_authenticatable (~> 1.9.0) + devise_saml_authenticatable (~> 1.9.1) discard (~> 1.2) exception_notification factory_bot_rails @@ -493,8 +484,8 @@ DEPENDENCIES font-awesome-rails foundation-datepicker-rails foundation-rails (~> 6.5.3.0) - friendly_id (~> 5.4.0) - haml-rails (~> 2.0.1) + friendly_id (~> 5.5.0) + haml-rails (~> 2.0) hotwire-rails i18n-debug jbuilder (~> 2.5) @@ -507,7 +498,7 @@ DEPENDENCIES paper_trail (= 11.1) pg puma (~> 5.6.8) - pundit + pundit (~> 2.3.1) pundit-matchers (~> 3.1.2) rails (= 6.1.7.6) rails-controller-testing @@ -517,7 +508,7 @@ DEPENDENCIES rspec (= 3.12.0) rspec-rails (= 6.1) rubocop - rubyzip (~> 2.3.0) + rubyzip (~> 2.3.2) sass-rails (>= 5) selenium-webdriver (~> 4.16.0) simplecov (~> 0.22) From 07aa256b6ef0de1e7e06fe77e004a040c91f1d3a Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 9 Jan 2024 11:51:58 -0600 Subject: [PATCH 06/25] WIP: update jquery-rails --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index fbf02e82..61265a6f 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem 'foundation-rails', '~> 6.5.3.0' gem 'foundation-datepicker-rails' gem 'friendly_id', '~> 5.5.0' gem 'haml-rails', '~> 2.0' -gem 'jquery-rails', '>= 4.3.5' +gem 'jquery-rails', '~> 4.6.0' gem 'jquery-ui-rails' gem 'pagy', '~> 4.10.1' gem 'ransack', github: 'activerecord-hackery/ransack' diff --git a/Gemfile.lock b/Gemfile.lock index 8ec6421a..b35310ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -214,7 +214,7 @@ GEM actionview (>= 5.0.0) activesupport (>= 5.0.0) jmespath (1.6.1) - jquery-rails (4.4.0) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -489,7 +489,7 @@ DEPENDENCIES hotwire-rails i18n-debug jbuilder (~> 2.5) - jquery-rails (>= 4.3.5) + jquery-rails (~> 4.6.0) jquery-ui-rails jsbundling-rails listen (~> 3.5.1) From a92798e5a95affec3d8155c872aed0101023929d Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 9 Jan 2024 13:28:52 -0600 Subject: [PATCH 07/25] WIP: update pagy gem and initializer --- Gemfile | 2 +- Gemfile.lock | 4 ++-- config/initializers/pagy.rb | 30 +++++++++++++++--------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index 61265a6f..f21c4ac8 100644 --- a/Gemfile +++ b/Gemfile @@ -41,7 +41,7 @@ gem 'friendly_id', '~> 5.5.0' gem 'haml-rails', '~> 2.0' gem 'jquery-rails', '~> 4.6.0' gem 'jquery-ui-rails' -gem 'pagy', '~> 4.10.1' +gem 'pagy', '~> 6.2.0' gem 'ransack', github: 'activerecord-hackery/ransack' gem 'sprockets-es6' gem 'trix' diff --git a/Gemfile.lock b/Gemfile.lock index b35310ba..7f4ec8d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -260,7 +260,7 @@ GEM nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (4.10.2) + pagy (6.2.0) paper_trail (11.1.0) activerecord (>= 5.2) request_store (~> 1.1) @@ -494,7 +494,7 @@ DEPENDENCIES jsbundling-rails listen (~> 3.5.1) nested_form - pagy (~> 4.10.1) + pagy (~> 6.2.0) paper_trail (= 11.1) pg puma (~> 5.6.8) diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb index b25ba7c9..da558ebe 100644 --- a/config/initializers/pagy.rb +++ b/config/initializers/pagy.rb @@ -19,7 +19,7 @@ # Countless extra: Paginate without any count, saving one query per rendering # See https://ddnexus.github.io/pagy/extras/countless # require 'pagy/extras/countless' -# Pagy::VARS[:cycle] = false # default +# Pagy::DEFAULT[:cycle] = false # default # Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects # See https://ddnexus.github.io/pagy/extras/elasticsearch_rails @@ -64,7 +64,7 @@ # Multi size var used by the *_nav_js helpers # See https://ddnexus.github.io/pagy/extras/navs#steps -# Pagy::VARS[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example +# Pagy::DEFAULT[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example # Feature Extras @@ -72,7 +72,7 @@ # Headers extra: http response headers (and other helpers) useful for API pagination # See http://ddnexus.github.io/pagy/extras/headers # require 'pagy/extras/headers' -# Pagy::VARS[:headers] = { page: 'Current-Page', items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' } # default +# Pagy::DEFAULT[:headers] = { page: 'Current-Page', items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' } # default # Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination # See https://ddnexus.github.io/pagy/extras/support @@ -81,13 +81,13 @@ # Items extra: Allow the client to request a custom number of items per page with an optional selector UI # See https://ddnexus.github.io/pagy/extras/items require 'pagy/extras/items' -Pagy::VARS[:items_param] = :custom_params # :items # default -Pagy::VARS[:max_items] = nil # 100 # default +Pagy::DEFAULT[:items_param] = :custom_params # :items # default +Pagy::DEFAULT[:max_items] = nil # 100 # default # Overflow extra: Allow for easy handling of overflowing pages # See https://ddnexus.github.io/pagy/extras/overflow # require 'pagy/extras/overflow' -# Pagy::VARS[:overflow] = :empty_page # default (other options: :last_page and :exception) +# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception) # Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc. # See https://ddnexus.github.io/pagy/extras/metadata @@ -95,7 +95,7 @@ # require 'pagy/extras/shared' # require 'pagy/extras/metadata' # For performance reason, you should explicitly set ONLY the metadata you use in the frontend -# Pagy::VARS[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example +# Pagy::DEFAULT[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example # Trim extra: Remove the page=1 param from links # See https://ddnexus.github.io/pagy/extras/trim @@ -105,22 +105,22 @@ # Pagy Variables # See https://ddnexus.github.io/pagy/api/pagy#variables -# All the Pagy::VARS are set for all the Pagy instances but can be overridden +# All the Pagy::DEFAULT are set for all the Pagy instances but can be overridden # per instance by just passing them to Pagy.new or the #pagy controller method # Instance variables # See https://ddnexus.github.io/pagy/api/pagy#instance-variables -# Pagy::VARS[:items] = 20 # default +# Pagy::DEFAULT[:items] = 20 # default # Other Variables # See https://ddnexus.github.io/pagy/api/pagy#other-variables -# Pagy::VARS[:size] = [1,4,4,1] # default -# Pagy::VARS[:page_param] = :page # default -# Pagy::VARS[:params] = {} # default -# Pagy::VARS[:anchor] = '#anchor' # example -# Pagy::VARS[:link_extra] = 'data-remote="true"' # example +# Pagy::DEFAULT[:size] = [1,4,4,1] # default +# Pagy::DEFAULT[:page_param] = :page # default +# Pagy::DEFAULT[:params] = {} # default +# Pagy::DEFAULT[:anchor] = '#anchor' # example +# Pagy::DEFAULT[:link_extra] = 'data-remote="true"' # example # Rails @@ -167,4 +167,4 @@ require 'pagy/extras/i18n' # Default i18n key -Pagy::VARS[:i18n_key] = 'pagy.item_name' # default +Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default From d3584f023e2f53d2328f164e31e18f43a7ad1896 Mon Sep 17 00:00:00 2001 From: jseraf Date: Thu, 11 Jan 2024 10:00:45 -0600 Subject: [PATCH 08/25] WIP: Bump ransack gem, fix deprecation message re: sort_link arguments --- Gemfile | 2 +- Gemfile.lock | 15 +++++---------- .../submissions/reviews_controller.rb | 2 ++ .../grant_submissions/submissions/index.html.haml | 14 +++++++------- .../submissions/reviews/index.html.haml | 6 +++--- app/views/grants/_sortable_table.html.haml | 10 +++++----- app/views/grants/reviews/index.html.haml | 10 +++++----- app/views/panels/_panel_content.html.haml | 6 +++--- .../panels/submissions/reviews/index.html.haml | 4 ++-- app/views/profiles/panels/index.html.haml | 6 +++--- app/views/profiles/reviews/index.html.haml | 12 ++++++------ app/views/profiles/submissions/index.html.haml | 8 ++++---- app/views/users/index.html.haml | 10 +++++----- 13 files changed, 51 insertions(+), 54 deletions(-) diff --git a/Gemfile b/Gemfile index f21c4ac8..1b9e0e76 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ gem 'haml-rails', '~> 2.0' gem 'jquery-rails', '~> 4.6.0' gem 'jquery-ui-rails' gem 'pagy', '~> 6.2.0' -gem 'ransack', github: 'activerecord-hackery/ransack' +gem 'ransack', '~> 3.2.1' gem 'sprockets-es6' gem 'trix' diff --git a/Gemfile.lock b/Gemfile.lock index 7f4ec8d6..140d8591 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,3 @@ -GIT - remote: https://github.com/activerecord-hackery/ransack.git - revision: 0fcf1b5ebf35e7dcd376754bdc0a6a101c46562b - specs: - ransack (2.6.0) - activerecord (>= 6.0.4) - activesupport (>= 6.0.4) - i18n - GEM remote: https://rubygems.org/ specs: @@ -316,6 +307,10 @@ GEM thor (~> 1.0) rainbow (3.1.1) rake (13.1.0) + ransack (3.2.1) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) + i18n rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) @@ -502,7 +497,7 @@ DEPENDENCIES pundit-matchers (~> 3.1.2) rails (= 6.1.7.6) rails-controller-testing - ransack! + ransack (~> 3.2.1) redis (~> 4.0) requestjs-rails rspec (= 3.12.0) diff --git a/app/controllers/grant_submissions/submissions/reviews_controller.rb b/app/controllers/grant_submissions/submissions/reviews_controller.rb index d6193072..13f57f2d 100644 --- a/app/controllers/grant_submissions/submissions/reviews_controller.rb +++ b/app/controllers/grant_submissions/submissions/reviews_controller.rb @@ -10,6 +10,8 @@ def index @grant = Grant.kept.with_criteria.friendly.find(params[:grant_id]) authorize @grant, :grant_viewer_access? @submission = GrantSubmission::Submission.includes(:submitter).find(params[:submission_id]) + + # START HERE @q = Review.with_reviewer.with_criteria_reviews.by_submission(@submission).ransack(params[:q]) @q.sorts = ['reviewer_last_name asc', 'overall_impact_score desc'] if @q.sorts.empty? @pagy, @reviews = pagy(@q.result, i18n_key: 'activerecord.models.review') diff --git a/app/views/grant_submissions/submissions/index.html.haml b/app/views/grant_submissions/submissions/index.html.haml index 3d4ea9d1..c4087f2a 100644 --- a/app/views/grant_submissions/submissions/index.html.haml +++ b/app/views/grant_submissions/submissions/index.html.haml @@ -62,24 +62,24 @@ .grid-x.grid-padding-x.align-bottom.header .cell.small-12.medium-1 - = sort_link(@q, :user_updated_at, 'Updated', {}, { title: 'Sort on Updated'} ) + = sort_link(@q, :user_updated_at, 'Updated', { title: 'Sort on Updated'} ) .cell.small-12.medium-2 - = sort_link(@q, :applicants_last_name, 'Applicants', {}, {title: 'Sort on Applicants'}) + = sort_link(@q, :applicants_last_name, 'Applicants', { title: 'Sort on Applicants'}) .cell.small-12{ class: submission_title_class } - = sort_link(@q, :title, 'Title', {}, { title: 'Sort on Title'} ) + = sort_link(@q, :title, 'Title', { title: 'Sort on Title'} ) .cell.small-12.medium-1 - = sort_link(@q, :state, 'State', {}, { title: 'Sort on State'} ) + = sort_link(@q, :state, 'State', { title: 'Sort on State'} ) - if user_has_grant_permissions .cell.small-12.medium-1 Reviews .cell.small-12.medium-1 %span{ title: 'Average of scored reviews - scored first' } - = sort_link(@q, :average_overall_impact_score_nulls_last, 'Overall Impact', {}, { title: 'Sort on Overal Impact Score'}) + = sort_link(@q, :average_overall_impact_score_nulls_last, 'Overall Impact', { title: 'Sort on Overal Impact Score'}) .cell.small-12.medium-1 %span{ title: 'Average of scored Criteria - scored first' } - = sort_link(@q, :composite_score_nulls_last, 'Composite', {}, { title: 'Sort on Composite Score'} ) + = sort_link(@q, :composite_score_nulls_last, 'Composite', { title: 'Sort on Composite Score'} ) .cell.small-12.medium-1 - = sort_link(@q, :awarded, 'Awarded', { default_order: :desc }, { title: 'Sort on Awarded' }) + = sort_link(@q, :awarded, 'Awarded', { default_order: :desc, title: 'Sort on Awarded' }) .rows{ data: { controller: 'checkbox-submit' } } - @submissions.each do |submission| diff --git a/app/views/grant_submissions/submissions/reviews/index.html.haml b/app/views/grant_submissions/submissions/reviews/index.html.haml index bea79851..f273dd50 100644 --- a/app/views/grant_submissions/submissions/reviews/index.html.haml +++ b/app/views/grant_submissions/submissions/reviews/index.html.haml @@ -48,11 +48,11 @@ %thead %tr %th - = sort_link(@q, :reviewer_last_name, 'Reviewer',{}, {title: 'Sort on Reviewer'}) + = sort_link(@q, :reviewer_last_name, 'Reviewer', { title: 'Sort on Reviewer'}) %th.pdf-hide - = sort_link(@q, :overall_impact, 'Review',{}, {title: 'Sort on Overall Impact Score'}) + = sort_link(@q, :overall_impact, 'Review', { title: 'Sort on Overall Impact Score'}) %th - = sort_link(@q, :overall_impact,{}, {title: 'Sort on Overall Impact Score'}) + = sort_link(@q, :overall_impact, { title: 'Sort on Overall Impact Score'}) %th Composite - @grant.criteria.each do |criterion| diff --git a/app/views/grants/_sortable_table.html.haml b/app/views/grants/_sortable_table.html.haml index df51ff56..666826bf 100644 --- a/app/views/grants/_sortable_table.html.haml +++ b/app/views/grants/_sortable_table.html.haml @@ -2,15 +2,15 @@ %thead %tr %th - = sort_link(q, :title, 'Grant Title', {}, { title: 'Sort on Grant Title' }) + = sort_link(q, :title, 'Grant Title', { title: 'Sort on Grant Title' }) %th - = sort_link(q, :state, 'State', {}, { title: 'Sort on State' }) + = sort_link(q, :state, 'State', { title: 'Sort on State' }) %th - = sort_link(q, :publish_date, {}, { title: 'Sort on Publish Date' }) + = sort_link(q, :publish_date, { title: 'Sort on Publish Date' }) %th - = sort_link(q, :submission_open_date, {}, { title: 'Sort on Submission Open Date' }) + = sort_link(q, :submission_open_date, { title: 'Sort on Submission Open Date' }) %th - = sort_link(q, :submission_close_date, {}, { title: 'Sort on Submission Close Date' }) + = sort_link(q, :submission_close_date, { title: 'Sort on Submission Close Date' }) %th %tbody diff --git a/app/views/grants/reviews/index.html.haml b/app/views/grants/reviews/index.html.haml index 668067fc..21a80213 100644 --- a/app/views/grants/reviews/index.html.haml +++ b/app/views/grants/reviews/index.html.haml @@ -53,15 +53,15 @@ %thead %tr %th - = sort_link(@q, :applicants_last_name, 'Applicants', {}, { title: 'Sort on Applicants' }) + = sort_link(@q, :applicants_last_name, 'Applicants', { title: 'Sort on Applicants' }) %th - = sort_link(@q, :submission_title, 'Submission', {}, { title: 'Sort on Submission Title' }) + = sort_link(@q, :submission_title, 'Submission', { title: 'Sort on Submission Title' }) %th - = sort_link(@q, :reviewer_last_name, 'Reviewer', {}, { title: 'Sort on Reviewer' }) + = sort_link(@q, :reviewer_last_name, 'Reviewer', { title: 'Sort on Reviewer' }) %th - = sort_link(@q, :state, 'Status', {}, { title: 'Sort on Overall Impact Score' }) + = sort_link(@q, :state, 'Status', { title: 'Sort on Overall Impact Score' }) %th - = sort_link(@q, :overall_impact_score, {}, { title: 'Sort on Overall Impact Score' }) + = sort_link(@q, :overall_impact_score, { title: 'Sort on Overall Impact Score' }) %th Composite Score %tbody diff --git a/app/views/panels/_panel_content.html.haml b/app/views/panels/_panel_content.html.haml index 7821b3ea..1549e5bd 100644 --- a/app/views/panels/_panel_content.html.haml +++ b/app/views/panels/_panel_content.html.haml @@ -15,9 +15,9 @@ .turbo-table .grid-x.grid-padding-x.align-bottom.header .cell.small-12.medium-2 - = sort_link(query, :applicants_last_name, 'Applicants', {}, { title: 'Sort on Applicants' }) + = sort_link(query, :applicants_last_name, 'Applicants', { title: 'Sort on Applicants' }) .cell.small-12.medium-4 - = sort_link(query, :title, 'Submission', {}, { title: 'Sort on Submission Title'} ) + = sort_link(query, :title, 'Submission', { title: 'Sort on Submission Title'} ) .cell.small-12.medium-1 Reviews .cell.small-12.medium-2 @@ -28,7 +28,7 @@ = sort_link(query, :composite_score, 'Composite Score') - if user_has_grant_permissions .cell.small-12.medium-1 - = sort_link(query, :awarded, 'Awarded', { default_order: :desc }, { title: 'Sort on Awarded' }) + = sort_link(query, :awarded, 'Awarded', { default_order: :desc, title: 'Sort on Awarded' }) .rows{ data: { controller: 'checkbox-submit' } } - @submissions.each do |submission| diff --git a/app/views/panels/submissions/reviews/index.html.haml b/app/views/panels/submissions/reviews/index.html.haml index dc0a48d2..7e90fb58 100644 --- a/app/views/panels/submissions/reviews/index.html.haml +++ b/app/views/panels/submissions/reviews/index.html.haml @@ -49,9 +49,9 @@ %thead %tr %th - = sort_link(@q, :reviewer_last_name, 'Reviewer',{}, {title: 'Sort on Reviewer'}) + = sort_link(@q, :reviewer_last_name, 'Reviewer', { title: 'Sort on Reviewer'}) %th - = sort_link(@q, :overall_impact,{}, { title: 'Sort on Overall Impact Score'} ) + = sort_link(@q, :overall_impact, { title: 'Sort on Overall Impact Score'} ) %th Composite - @grant.criteria.each do |criterion| diff --git a/app/views/profiles/panels/index.html.haml b/app/views/profiles/panels/index.html.haml index 02a869a3..cf2f74b2 100644 --- a/app/views/profiles/panels/index.html.haml +++ b/app/views/profiles/panels/index.html.haml @@ -26,11 +26,11 @@ %thead %tr %th - = sort_link(@q, :name, 'Grant', {}, { title: 'Sort on Grant Title' }) + = sort_link(@q, :name, 'Grant', { title: 'Sort on Grant Title' }) %th - = sort_link(@q, :review_close_date, {}, { title: 'Sort on Review Close' }) + = sort_link(@q, :review_close_date, { title: 'Sort on Review Close' }) %th - = sort_link(@q, 'panel_start_datetime', 'Panel Start',{}, { title: 'Sort on Panel Start' }) + = sort_link(@q, 'panel_start_datetime', 'Panel Start', { title: 'Sort on Panel Start' }) %tbody - @grants.each do |grant| %tr.panel diff --git a/app/views/profiles/reviews/index.html.haml b/app/views/profiles/reviews/index.html.haml index 5b60c957..0992e381 100644 --- a/app/views/profiles/reviews/index.html.haml +++ b/app/views/profiles/reviews/index.html.haml @@ -26,17 +26,17 @@ %thead %tr %th - = sort_link(@q, :overall_impact_score, 'Status', {}, { title: 'Sort on Status' }) + = sort_link(@q, :overall_impact_score, 'Status', { title: 'Sort on Status' }) %th - = sort_link(@q, :grant_name, 'Grant', {}, { title: 'Sort on Grant' }) + = sort_link(@q, :grant_name, 'Grant', { title: 'Sort on Grant' }) %th - = sort_link(@q, :applicants_last_name, 'Applicants', {}, { title: 'Sort on Applicants' }) + = sort_link(@q, :applicants_last_name, 'Applicants', { title: 'Sort on Applicants' }) %th - = sort_link(@q, :submission_title, 'Submission Title', {}, { title: 'Sort on Submission Title' }) + = sort_link(@q, :submission_title, 'Submission Title', { title: 'Sort on Submission Title' }) %th - = sort_link(@q, :created_at, 'Assigned On', {}, { title: 'Sort on Assigned Date' }) + = sort_link(@q, :created_at, 'Assigned On', { title: 'Sort on Assigned Date' }) %th - = sort_link(@q, :grant_review_close_date, 'Due by Date', {}, { title: 'Sort on Due Date' }) + = sort_link(@q, :grant_review_close_date, 'Due by Date', { title: 'Sort on Due Date' }) %tbody - @reviews.each do |review| diff --git a/app/views/profiles/submissions/index.html.haml b/app/views/profiles/submissions/index.html.haml index fe64a184..759d5ae3 100644 --- a/app/views/profiles/submissions/index.html.haml +++ b/app/views/profiles/submissions/index.html.haml @@ -25,13 +25,13 @@ %thead %tr %th - = sort_link(@q, :title, 'Project Title',{}, {title: 'Sort on Project Title'}) + = sort_link(@q, :title, 'Project Title', { title: 'Sort on Project Title'}) %th - = sort_link(@q, :grant_name, 'Grant',{}, {title: 'Sort on Grant Name'}) + = sort_link(@q, :grant_name, 'Grant', { title: 'Sort on Grant Name'}) %th - = sort_link(@q, :state, 'State',{}, {title: 'Sort on State'}) + = sort_link(@q, :state, 'State', { title: 'Sort on State'}) %th - = sort_link(@q, :updated_at, 'Last Updated',{}, {title: 'Sort on Updated'}) + = sort_link(@q, :updated_at, 'Last Updated', { title: 'Sort on Updated'}) %th %tbody - @submissions.each do |submission| diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index edd57fa2..53d179d0 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -26,15 +26,15 @@ %thead %tr %th - = sort_link(@q, :last_name, 'Name', {}, {title: 'Sort on Name'}) + = sort_link(@q, :last_name, 'Name', { title: 'Sort on Name'}) %th - = sort_link(@q, :email, {}, { title: 'Sort on Email' }) + = sort_link(@q, :email, { title: 'Sort on Email' }) %th - = sort_link(@q, :type_nulls_last, t('helpers.label.user.type'), {}, { title: 'Sort on User Type' }) + = sort_link(@q, :type_nulls_last, t('helpers.label.user.type'), { title: 'Sort on User Type' }) %th - = sort_link(@q, :created_at, t('helpers.label.user.created_at'), {}, { title: 'Sort on Join Date' }) + = sort_link(@q, :created_at, t('helpers.label.user.created_at'), { title: 'Sort on Join Date' }) %th - = sort_link(@q, :current_sign_in_at_nulls_last, I18n.t('helpers.label.user.current_sign_in_at'), {}, { title: 'Sort on Last Access' }) + = sort_link(@q, :current_sign_in_at_nulls_last, I18n.t('helpers.label.user.current_sign_in_at'), { title: 'Sort on Last Access' }) %th - @users.each do |user| From efa867c64cfb6f41b2b5e73100b499ff862923e5 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 12 Jan 2024 14:27:47 -0600 Subject: [PATCH 09/25] WIP: Fix review score sorting to favor submitted reviews --- .../concerns/ransack_review_sort.rb | 33 +++++++++++++++++++ .../submissions/reviews_controller.rb | 7 ++-- app/controllers/grants/reviews_controller.rb | 11 ++++--- .../submissions/reviews/_review.html.haml | 3 +- .../submissions/reviews/index.html.haml | 4 +-- app/views/grants/_sortable_table.html.haml | 2 +- 6 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 app/controllers/concerns/ransack_review_sort.rb diff --git a/app/controllers/concerns/ransack_review_sort.rb b/app/controllers/concerns/ransack_review_sort.rb new file mode 100644 index 00000000..97e989c8 --- /dev/null +++ b/app/controllers/concerns/ransack_review_sort.rb @@ -0,0 +1,33 @@ +module RansackReviewSort + extend ActiveSupport::Concern + + # Explicitly favors submitted reviews when sorting on overall_impact_score + def set_ransack_submission_reviews_sort_query_results(submission) + overall_impact_sort_query_order = overall_impact_score_sort + + if overall_impact_sort_query_order.present? + @q = Review.includes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_submission(submission).order(state: :desc).order(overall_impact_score: overall_impact_sort_query_order).ransack() + @q.sorts = ['state desc', params[:q]['s']] + else + @q = Reviewincludes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_submission(submission).ransack(params[:q]) + @q.sorts = ['reviewer_last_name asc', 'overall_impact_score desc'] if @q.sorts.empty? + end + end + + def set_ransack_grant_reviews_sort_query_results(grant) + overall_impact_sort_query_order = overall_impact_score_sort + + if overall_impact_sort_query_order.present? + @q = Review.includes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_grant(grant).order(state: :desc).order(overall_impact_score: overall_impact_score_sort).ransack() + @q.sorts = ['state desc', params[:q]['s']] + else + @q = Review.includes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_grant(grant).ransack(params[:q]) + @q.sorts = ['reviewer_last_name asc', 'overall_impact_score desc'] if @q.sorts.empty? + end + end + + def overall_impact_score_sort + sort_query = params.dig(:q, :s) + overall_impact_score_sort_order = sort_query.split(' ').last.to_sym if sort_query&.include?('overall_impact_score') + end +end diff --git a/app/controllers/grant_submissions/submissions/reviews_controller.rb b/app/controllers/grant_submissions/submissions/reviews_controller.rb index 13f57f2d..839302cc 100644 --- a/app/controllers/grant_submissions/submissions/reviews_controller.rb +++ b/app/controllers/grant_submissions/submissions/reviews_controller.rb @@ -1,6 +1,8 @@ module GrantSubmissions module Submissions class ReviewsController < ApplicationController + include RansackReviewSort + before_action :set_review_grant_and_submission, only: %i[show edit update destroy] skip_after_action :verify_policy_scoped, only: :index @@ -11,9 +13,8 @@ def index authorize @grant, :grant_viewer_access? @submission = GrantSubmission::Submission.includes(:submitter).find(params[:submission_id]) - # START HERE - @q = Review.with_reviewer.with_criteria_reviews.by_submission(@submission).ransack(params[:q]) - @q.sorts = ['reviewer_last_name asc', 'overall_impact_score desc'] if @q.sorts.empty? + set_ransack_submission_reviews_sort_query_results(@submission) + @pagy, @reviews = pagy(@q.result, i18n_key: 'activerecord.models.review') respond_to do |format| format.html { render :index } diff --git a/app/controllers/grants/reviews_controller.rb b/app/controllers/grants/reviews_controller.rb index f1fa008b..cbe64cd6 100644 --- a/app/controllers/grants/reviews_controller.rb +++ b/app/controllers/grants/reviews_controller.rb @@ -1,22 +1,23 @@ module Grants class ReviewsController < ApplicationController + include RansackReviewSort + skip_after_action :verify_policy_scoped, only: %i[index] def index - if request.format.html? - @grant = Grant.kept.friendly.with_reviews.find(params[:grant_id]) + @grant = Grant.kept.friendly.find(params[:grant_id]) authorize @grant, :grant_viewer_access? - @q = Review.by_grant(@grant).ransack(params[:q]) - @q.sorts = 'applicants_last_name asc' if @q.sorts.empty? + set_ransack_grant_reviews_sort_query_results(@grant) + @pagy, @reviews = pagy_array(@q.result, i18n_key: 'activerecord.models.review') elsif request.format.xlsx? @grant = Grant.with_criteria.kept.friendly.find(params[:grant_id]) authorize @grant, :grant_viewer_access? @criteria = @grant.criteria - @reviews = Review.with_grant_and_submitter_and_applicants.with_criteria_reviews.by_grant(@grant) + @reviews = Review.with_grant_and_submitter_and_applicants.with_reviewer.with_criteria_reviews.by_grant(@grant) end respond_to do |format| diff --git a/app/views/grant_submissions/submissions/reviews/_review.html.haml b/app/views/grant_submissions/submissions/reviews/_review.html.haml index 042de08e..c7847591 100644 --- a/app/views/grant_submissions/submissions/reviews/_review.html.haml +++ b/app/views/grant_submissions/submissions/reviews/_review.html.haml @@ -10,5 +10,4 @@ - @grant.criteria.each do |criterion| %td - criterion_score = review.criteria_reviews.detect { |cr| cr.criterion_id == criterion.id } - =# (criterion_score.nil? || criterion_score.score.nil?)? '-' : criterion_score.score - = review.submitted? ? criterion_score.score : '-' + = review.submitted? && criterion_score.score.present? ? criterion_score.score : '-' diff --git a/app/views/grant_submissions/submissions/reviews/index.html.haml b/app/views/grant_submissions/submissions/reviews/index.html.haml index f273dd50..00486039 100644 --- a/app/views/grant_submissions/submissions/reviews/index.html.haml +++ b/app/views/grant_submissions/submissions/reviews/index.html.haml @@ -50,9 +50,9 @@ %th = sort_link(@q, :reviewer_last_name, 'Reviewer', { title: 'Sort on Reviewer'}) %th.pdf-hide - = sort_link(@q, :overall_impact, 'Review', { title: 'Sort on Overall Impact Score'}) + = sort_link(@q, :state, 'Review', { title: 'Sort on Status'}) %th - = sort_link(@q, :overall_impact, { title: 'Sort on Overall Impact Score'}) + = sort_link(@q, :overall_impact_score, { title: 'Sort on Overall Impact Score', data: { turbo: false }}) %th Composite - @grant.criteria.each do |criterion| diff --git a/app/views/grants/_sortable_table.html.haml b/app/views/grants/_sortable_table.html.haml index 666826bf..6b48bf72 100644 --- a/app/views/grants/_sortable_table.html.haml +++ b/app/views/grants/_sortable_table.html.haml @@ -2,7 +2,7 @@ %thead %tr %th - = sort_link(q, :title, 'Grant Title', { title: 'Sort on Grant Title' }) + = sort_link(q, :name, 'Name', { title: 'Sort on Grant Name' }) %th = sort_link(q, :state, 'State', { title: 'Sort on State' }) %th From cfe6c75496c1f1e39ee3b61dc82d235acdea46f1 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 12 Jan 2024 14:40:22 -0600 Subject: [PATCH 10/25] WIP: typo fix --- app/controllers/concerns/ransack_review_sort.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/ransack_review_sort.rb b/app/controllers/concerns/ransack_review_sort.rb index 97e989c8..7efd2ec4 100644 --- a/app/controllers/concerns/ransack_review_sort.rb +++ b/app/controllers/concerns/ransack_review_sort.rb @@ -9,7 +9,7 @@ def set_ransack_submission_reviews_sort_query_results(submission) @q = Review.includes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_submission(submission).order(state: :desc).order(overall_impact_score: overall_impact_sort_query_order).ransack() @q.sorts = ['state desc', params[:q]['s']] else - @q = Reviewincludes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_submission(submission).ransack(params[:q]) + @q = Review.includes(:grant, :reviewer, :criteria_reviews, submission: [:applicants, :submitter]).by_submission(submission).ransack(params[:q]) @q.sorts = ['reviewer_last_name asc', 'overall_impact_score desc'] if @q.sorts.empty? end end From cc8d78ab9e76725184e325f86f01283167fb236e Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 12 Jan 2024 15:18:45 -0600 Subject: [PATCH 11/25] WIP: update discard --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 1b9e0e76..265b9b5a 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,7 @@ gem 'sprockets-es6' gem 'trix' # audits -gem 'discard', '~> 1.2' +gem 'discard', '~> 1.3' gem 'paper_trail', '11.1' gem 'exception_notification' diff --git a/Gemfile.lock b/Gemfile.lock index 140d8591..d51fac0e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -156,7 +156,7 @@ GEM devise (> 2.0.0) ruby-saml (~> 1.7) diff-lcs (1.5.0) - discard (1.2.1) + discard (1.3.0) activerecord (>= 4.2, < 8) docile (1.4.0) erubi (1.12.0) @@ -228,7 +228,7 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.20.0) + minitest (5.21.1) msgpack (1.7.2) nested_form (0.3.2) net-imap (0.3.7) @@ -472,7 +472,7 @@ DEPENDENCIES cocoon devise (= 4.9.3) devise_saml_authenticatable (~> 1.9.1) - discard (~> 1.2) + discard (~> 1.3) exception_notification factory_bot_rails faker (~> 3.2.2) From 2d247c872927e8f38eb29e971a2f8ced7d297fed Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 16 Jan 2024 13:04:31 -0600 Subject: [PATCH 12/25] WIP: update paper_trail gem --- Gemfile | 16 ++++++++-------- Gemfile.lock | 10 +++++----- app/models/paper_trail/version.rb | 3 ++- config/application.rb | 6 ++++++ 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 265b9b5a..46f30c4f 100644 --- a/Gemfile +++ b/Gemfile @@ -35,20 +35,20 @@ gem 'rubyzip', '~> 2.3.2' # frontend gem 'font-awesome-rails' -gem 'foundation-rails', '~> 6.5.3.0' +gem 'foundation-rails', '~> 6.5.3.0' gem 'foundation-datepicker-rails' -gem 'friendly_id', '~> 5.5.0' -gem 'haml-rails', '~> 2.0' -gem 'jquery-rails', '~> 4.6.0' +gem 'friendly_id', '~> 5.5.0' +gem 'haml-rails', '~> 2.0' +gem 'jquery-rails', '~> 4.6.0' gem 'jquery-ui-rails' -gem 'pagy', '~> 6.2.0' -gem 'ransack', '~> 3.2.1' +gem 'pagy', '~> 6.2.0' +gem 'ransack', '~> 3.2.1' gem 'sprockets-es6' gem 'trix' # audits -gem 'discard', '~> 1.3' -gem 'paper_trail', '11.1' +gem 'discard', '~> 1.3' +gem 'paper_trail', '~> 15.1.0' gem 'exception_notification' diff --git a/Gemfile.lock b/Gemfile.lock index d51fac0e..255c773f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,7 +142,7 @@ GEM caxlsx (>= 3.0) cocoon (1.2.15) coderay (1.1.3) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) crass (1.0.6) date (3.3.3) debug_inspector (1.1.0) @@ -252,9 +252,9 @@ GEM racc (~> 1.4) orm_adapter (0.5.0) pagy (6.2.0) - paper_trail (11.1.0) - activerecord (>= 5.2) - request_store (~> 1.1) + paper_trail (15.1.0) + activerecord (>= 6.1) + request_store (~> 1.4) parallel (1.22.1) parser (3.1.2.0) ast (~> 2.4.1) @@ -490,7 +490,7 @@ DEPENDENCIES listen (~> 3.5.1) nested_form pagy (~> 6.2.0) - paper_trail (= 11.1) + paper_trail (~> 15.1.0) pg puma (~> 5.6.8) pundit (~> 2.3.1) diff --git a/app/models/paper_trail/version.rb b/app/models/paper_trail/version.rb index afc16703..13cbd26e 100644 --- a/app/models/paper_trail/version.rb +++ b/app/models/paper_trail/version.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true module PaperTrail - class Version < ApplicationRecord + class Version < ActiveRecord::Base include PaperTrail::VersionConcern + self.abstract_class = true end end diff --git a/config/application.rb b/config/application.rb index 66117dee..b2929cc6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,6 +31,12 @@ class Application < Rails::Application # Was not in Rails 6.0. Default in rails 6.1 is :lax, not :strict # This suppresses browser messages in console. config.action_dispatch.cookies_same_site_protection = :lax + + # Added 1/16/24 + # Update paper_trail to v15.1, review after upgrading to rails 7 + # error `Psych::DisallowedClass, Tried to load unspecified class: Time` + # Per Rails guide, default setting is [Symbol] + config.active_record.yaml_column_permitted_classes = [Symbol, Time] end end From 36b8a8bc70b4c228fd494c7bd65fa9d2aee0ade6 Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 16 Jan 2024 13:28:27 -0600 Subject: [PATCH 13/25] WIP: update american_date and validates_timeliness --- Gemfile | 4 ++-- Gemfile.lock | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 46f30c4f..0e0cd26e 100644 --- a/Gemfile +++ b/Gemfile @@ -52,8 +52,8 @@ gem 'paper_trail', '~> 15.1.0' gem 'exception_notification' -gem 'american_date' -gem 'validates_timeliness', '6.0.0.alpha1' +gem 'american_date', '~> 1.3' +gem 'validates_timeliness', '~> 6.0.1' # form_builder gem "cocoon" diff --git a/Gemfile.lock b/Gemfile.lock index 255c773f..d11a0c41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -64,7 +64,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - american_date (1.2.0) + american_date (1.3.0) annotate (3.2.0) activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) @@ -411,7 +411,7 @@ GEM execjs (>= 0.3.0, < 3) thor (1.3.0) tilt (2.3.0) - timeliness (0.4.4) + timeliness (0.4.5) timeout (0.4.0) trix (0.10.1) rails @@ -423,7 +423,8 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) uniform_notifier (1.16.0) - validates_timeliness (6.0.0.alpha1) + validates_timeliness (6.0.1) + activemodel (>= 6.0.0, < 7) timeliness (>= 0.3.10, < 1) warden (1.2.9) rack (>= 2.0.9) @@ -451,7 +452,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - american_date + american_date (~> 1.3) annotate awesome_print aws-sdk-s3 @@ -514,7 +515,7 @@ DEPENDENCIES trix turbo-rails (~> 1.4.0) tzinfo-data - validates_timeliness (= 6.0.0.alpha1) + validates_timeliness (~> 6.0.1) web-console (>= 3.3.0) webrick (= 1.8.1) wicked_pdf From 5d93fe723da32f4e4087324f29da945174f0f18a Mon Sep 17 00:00:00 2001 From: jseraf Date: Tue, 16 Jan 2024 15:08:14 -0600 Subject: [PATCH 14/25] WIP: update xls related gem, specify wicked_pdf version --- Gemfile | 6 +++--- Gemfile.lock | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 0e0cd26e..38f80ec0 100644 --- a/Gemfile +++ b/Gemfile @@ -64,10 +64,10 @@ gem "nested_form" gem "aws-sdk-s3", require: false # exports -gem 'caxlsx' +gem 'caxlsx', '~> 3.3' gem 'caxlsx_rails' -gem 'wicked_pdf' -gem 'wkhtmltopdf-binary' +gem 'wicked_pdf', '~> 2.1.0' +gem 'wkhtmltopdf-binary', '~> 0.12.6' group :development, :test do gem 'awesome_print' diff --git a/Gemfile.lock b/Gemfile.lock index d11a0c41..2842f896 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,7 +132,7 @@ GEM regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) capybara-select-2 (0.5.1) - caxlsx (3.2.0) + caxlsx (3.4.1) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) @@ -440,7 +440,7 @@ GEM websocket-extensions (0.1.5) wicked_pdf (2.1.0) activesupport - wkhtmltopdf-binary (0.12.6.5) + wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.6.12) @@ -468,7 +468,7 @@ DEPENDENCIES capistrano-service capybara (~> 3.39.2) capybara-select-2 - caxlsx + caxlsx (~> 3.3) caxlsx_rails cocoon devise (= 4.9.3) @@ -518,8 +518,8 @@ DEPENDENCIES validates_timeliness (~> 6.0.1) web-console (>= 3.3.0) webrick (= 1.8.1) - wicked_pdf - wkhtmltopdf-binary + wicked_pdf (~> 2.1.0) + wkhtmltopdf-binary (~> 0.12.6) BUNDLED WITH 2.2.22 From 60a261c574323b654ba4eb309a3c15e00dac7e92 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 13:26:14 -0600 Subject: [PATCH 15/25] WIP: Upgrade to rails 7.0.8 --- Gemfile | 4 +- Gemfile.lock | 148 +++++++++++++++++++++++++++------------------------ 2 files changed, 79 insertions(+), 73 deletions(-) diff --git a/Gemfile b/Gemfile index 38f80ec0..93188c39 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'pg' -gem 'rails', '6.1.7.6' +gem 'rails', '~> 7.0.8' # Use SCSS for stylesheets gem 'sass-rails', '>= 5' @@ -53,7 +53,7 @@ gem 'paper_trail', '~> 15.1.0' gem 'exception_notification' gem 'american_date', '~> 1.3' -gem 'validates_timeliness', '~> 6.0.1' +gem 'validates_timeliness', '7.0.0.beta2' # form_builder gem "cocoon" diff --git a/Gemfile.lock b/Gemfile.lock index 2842f896..12703916 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,65 +1,71 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) mail (>= 2.7.1) - actionmailer (6.1.7.6) - actionpack (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activesupport (= 6.1.7.6) + net-imap + net-pop + net-smtp + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7.6) - actionview (= 6.1.7.6) - activesupport (= 6.1.7.6) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.6) - actionpack (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.6) - activesupport (= 6.1.7.6) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.6) - activesupport (= 6.1.7.6) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (6.1.7.6) - activesupport (= 6.1.7.6) - activerecord (6.1.7.6) - activemodel (= 6.1.7.6) - activesupport (= 6.1.7.6) - activestorage (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activesupport (= 6.1.7.6) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.6) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) airbrussh (1.4.0) @@ -144,7 +150,7 @@ GEM coderay (1.1.3) concurrent-ruby (1.2.3) crass (1.0.6) - date (3.3.3) + date (3.3.4) debug_inspector (1.1.0) devise (4.9.3) bcrypt (~> 3.0) @@ -181,8 +187,8 @@ GEM sprockets-es6 (>= 0.9.0) friendly_id (5.5.1) activerecord (>= 4.0.0) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) haml (6.3.0) temple (>= 0.8.2) thor @@ -211,7 +217,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - jsbundling-rails (1.0.2) + jsbundling-rails (1.2.2) railties (>= 6.0.0) listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) @@ -228,19 +234,19 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.21.1) + minitest (5.21.2) msgpack (1.7.2) nested_form (0.3.2) - net-imap (0.3.7) + net-imap (0.4.9.1) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) - net-smtp (0.3.3) + net-smtp (0.4.0.1) net-protocol net-ssh (6.1.0) nio4r (2.7.0) @@ -273,21 +279,20 @@ GEM rack (2.2.8) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.6) - actioncable (= 6.1.7.6) - actionmailbox (= 6.1.7.6) - actionmailer (= 6.1.7.6) - actionpack (= 6.1.7.6) - actiontext (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activemodel (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 6.1.7.6) - sprockets-rails (>= 2.0.0) + railties (= 7.0.8) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -299,12 +304,13 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.1.0) ransack (3.2.1) @@ -412,7 +418,7 @@ GEM thor (1.3.0) tilt (2.3.0) timeliness (0.4.5) - timeout (0.4.0) + timeout (0.4.1) trix (0.10.1) rails turbo-rails (1.4.0) @@ -423,12 +429,12 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) uniform_notifier (1.16.0) - validates_timeliness (6.0.1) - activemodel (>= 6.0.0, < 7) + validates_timeliness (7.0.0.beta2) + activemodel (>= 7.0.0, < 8) timeliness (>= 0.3.10, < 1) warden (1.2.9) rack (>= 2.0.9) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -496,7 +502,7 @@ DEPENDENCIES puma (~> 5.6.8) pundit (~> 2.3.1) pundit-matchers (~> 3.1.2) - rails (= 6.1.7.6) + rails (~> 7.0.8) rails-controller-testing ransack (~> 3.2.1) redis (~> 4.0) @@ -515,11 +521,11 @@ DEPENDENCIES trix turbo-rails (~> 1.4.0) tzinfo-data - validates_timeliness (~> 6.0.1) + validates_timeliness (= 7.0.0.beta2) web-console (>= 3.3.0) webrick (= 1.8.1) wicked_pdf (~> 2.1.0) wkhtmltopdf-binary (~> 0.12.6) BUNDLED WITH - 2.2.22 + 2.3.27 From c4102c2a2ca46e7d4a751a2409113403b7a236ba Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 13:39:21 -0600 Subject: [PATCH 16/25] WIP: Fix "Deprecate passing a format to `#to_s` in favor of `#to_fs`" warnings --- app/helpers/application_helper.rb | 2 +- app/helpers/grants_helper.rb | 2 +- app/helpers/reviews_helper.rb | 4 +- app/views/banners/_form.html.haml | 4 +- .../invitations/_invitation.html.haml | 4 +- .../submissions/reviews/_form.html.haml | 6 +- app/views/grants/_dates_card.html.haml | 2 +- app/views/grants/_form.html.haml | 10 +-- app/views/profiles/panels/index.html.haml | 2 +- config/locales/activerecord/review.yml | 2 +- lib/grant_submission_form_builder.rb | 2 +- spec/factories/grant_submission_response.rb | 2 +- spec/models/review_spec.rb | 4 +- spec/system/grants/duplicate_spec.rb | 40 ++++++------ spec/system/grants/grants_spec.rb | 63 ++++++++++--------- 15 files changed, 76 insertions(+), 73 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bfad5f4a..3f5a5d53 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,7 +42,7 @@ def title_tag_content(page_title: '') # Dates def date_mmddyyyy(date) - date.blank? ? '' : date.strftime('%m/%d/%Y') + date.blank? ? '' : date.to_fs end def date_time_separate_lines(date) diff --git a/app/helpers/grants_helper.rb b/app/helpers/grants_helper.rb index f6ba9109..18ef90e2 100644 --- a/app/helpers/grants_helper.rb +++ b/app/helpers/grants_helper.rb @@ -32,7 +32,7 @@ def populate_grant_tabs(grant_permission_role:, grant:) end def submission_period(grant:) - "#{time_tag(grant.submission_open_date.beginning_of_day, grant.submission_open_date, class: 'open')} — #{time_tag(grant.submission_close_date.end_of_day, grant.submission_close_date, class: 'close')}".html_safe + "#{time_tag(grant.submission_open_date.beginning_of_day, grant.submission_open_date.to_fs, class: 'open')} — #{time_tag(grant.submission_close_date.end_of_day, grant.submission_close_date.to_fs, class: 'close')}".html_safe end def grant_name_class(grant:) diff --git a/app/helpers/reviews_helper.rb b/app/helpers/reviews_helper.rb index 0d2acbc1..34908614 100644 --- a/app/helpers/reviews_helper.rb +++ b/app/helpers/reviews_helper.rb @@ -18,8 +18,8 @@ def display_review_data(review:, user:, grant: review.grant, submission: review. link: link, overall_impact_score: overall_impact_score, composite_score: composite_score, - created_date: time_tag(review.created_at, review.created_at.to_date.to_formatted_s(:default)), - due_date: time_tag(review.grant.review_close_date.end_of_day, review.grant.review_close_date.to_formatted_s(:default))) + created_date: time_tag(review.created_at, review.created_at.to_date.to_fs), + due_date: time_tag(review.grant.review_close_date.end_of_day, review.grant.review_close_date.to_fs)) end def find_review_by_submission_and_reviewer(submission, reviewer) diff --git a/app/views/banners/_form.html.haml b/app/views/banners/_form.html.haml index 85cf7b01..8ee6934c 100644 --- a/app/views/banners/_form.html.haml +++ b/app/views/banners/_form.html.haml @@ -13,12 +13,12 @@ .cell.small-12.medium-2.text-left = f.label :created_at, class: 'small' .cell.small-12.medium-3 - = banner.created_at + = banner.created_at&.to_fs .grid-x.grid-padding-y .cell.small-12.medium-2 = f.label :updated_at, class: 'small' .cell.small-12.medium-3 - = banner.updated_at + = banner.updated_at&.to_fs .grid-x .actions - if banner.new_record? diff --git a/app/views/grant_reviewers/invitations/_invitation.html.haml b/app/views/grant_reviewers/invitations/_invitation.html.haml index fa9985e7..cad22c65 100644 --- a/app/views/grant_reviewers/invitations/_invitation.html.haml +++ b/app/views/grant_reviewers/invitations/_invitation.html.haml @@ -2,9 +2,9 @@ %td.email = invitation.email %td.created - = time_tag(invitation.created_at.to_date, invitation.created_at.to_date) + = time_tag(invitation.created_at.to_date, invitation.created_at.to_date.to_fs) %td.confirmation - = (invitation.confirmed_at.nil?) ? '-' : time_tag(invitation.confirmed_at, invitation.confirmed_at.to_formatted_s(:default)) + = (invitation.confirmed_at.nil?) ? '-' : time_tag(invitation.confirmed_at, invitation.confirmed_at.to_fs) %td.inviter = full_name(invitation.inviter) %td.manage diff --git a/app/views/grant_submissions/submissions/reviews/_form.html.haml b/app/views/grant_submissions/submissions/reviews/_form.html.haml index 680c653d..36403536 100644 --- a/app/views/grant_submissions/submissions/reviews/_form.html.haml +++ b/app/views/grant_submissions/submissions/reviews/_form.html.haml @@ -4,7 +4,7 @@ .callout.warning Review period is closed -= form_for review, url: grant_submission_review_url(grant, submission, review), html: { novalidate: true, data: { abide: '' } }, local: true, data: { turbo: false } do |f| += form_for review, url: grant_submission_review_url(grant, submission, review), html: { novalidate: true }, local: true, data: { turbo: false } do |f| - if review.criteria_reviews.any? %h3 Review Criteria @@ -21,6 +21,6 @@ Please check the required scores. .actions - = f.button 'Save as Draft', type: 'submit', disabled: disabled, name: 'review[state]', value: Review::REVIEW_STATES[:draft], data: { confirm: "You are saving this review as a draft. Scores here will not count toward the submission until this review has been submitted. You may submit it until #{grant.review_close_date}.", disable_with: 'Please wait'}, class: 'secondary button' - = f.button 'Submit Your Review', type: 'submit', disabled: disabled, name: 'review[state]', value: Review::REVIEW_STATES[:submitted], data: { disable_with: "Please wait..." }, class: 'success button' + = f.button 'Save as Draft', name: 'review[state]', value: Review::REVIEW_STATES[:draft], type: 'submit', disabled: disabled, data: { confirm: "You are saving this review as a draft. Scores here will not count toward the submission until this review has been submitted. You may submit it until #{grant.review_close_date.to_fs}.", disable_with: 'Please wait'}, class: 'secondary button' + = f.button 'Submit Your Review', name: 'review[state]', value: Review::REVIEW_STATES[:submitted], type: 'submit', disabled: disabled, data: { disable_with: "Please wait..." }, class: 'success button' diff --git a/app/views/grants/_dates_card.html.haml b/app/views/grants/_dates_card.html.haml index 23d973ba..fd6db488 100644 --- a/app/views/grants/_dates_card.html.haml +++ b/app/views/grants/_dates_card.html.haml @@ -6,7 +6,7 @@ %dt Publish Date: %dd - = time_tag(grant.publish_date, grant.publish_date) + = time_tag(grant.publish_date, grant.publish_date.to_fs) %dt Submission Period: %dd diff --git a/app/views/grants/_form.html.haml b/app/views/grants/_form.html.haml index e22c6aeb..8cce9afe 100644 --- a/app/views/grants/_form.html.haml +++ b/app/views/grants/_form.html.haml @@ -29,29 +29,29 @@ .cell.small-12.medium-3 = f.label :publish_date, 'Publish Date', class: 'middle' .cell.small-12.medium-9 - = f.text_field :publish_date, value: date_mmddyyyy(grant.publish_date ||= Date.today), required: true, disabled: disable_fields, class: 'small-12 medium-4', aria: { 'described-by': 'publishDateHelp' } + = f.text_field :publish_date, value: (grant.publish_date ||= Date.today).to_fs, required: true, disabled: disable_fields, class: 'small-12 medium-4', aria: { 'described-by': 'publishDateHelp' } %p.help-text#publishDateHelp When published, your grant will be publicly available on this date. .grid-x .cell.small-12.medium-3 = f.label :submission_open_date, 'Submission Open Date', class: 'middle' .cell.small-12.medium-9 - = f.text_field :submission_open_date, value: grant.submission_open_date, placeholder: 'mm/dd/YYYY', required: true, disabled: disable_fields, class: 'small-12 medium-4' + = f.text_field :submission_open_date, value: grant.submission_open_date&.to_fs, placeholder: 'mm/dd/YYYY', required: true, disabled: disable_fields, class: 'small-12 medium-4' .grid-x .cell.small-12.medium-3 = f.label :submission_close_date, 'Submission Close Date', class: 'middle' .cell.small-12.medium-9 - = f.text_field :submission_close_date, value: grant.submission_close_date, placeholder: 'mm/dd/YYYY', required: true, disabled: disable_fields, class: 'small-12 medium-4' + = f.text_field :submission_close_date, value: grant.submission_close_date&.to_fs, placeholder: 'mm/dd/YYYY', required: true, disabled: disable_fields, class: 'small-12 medium-4' .grid-x .cell.small-12.medium-3 = f.label :review_open_date, 'Review Open Date', class: 'middle' .cell.small-12.medium-9 - = f.text_field :review_open_date, value: grant.review_open_date, disabled: disable_fields, class: 'small-12 medium-4' + = f.text_field :review_open_date, value: grant.review_open_date&.to_fs, disabled: disable_fields, class: 'small-12 medium-4' .grid-x .cell.small-12.medium-3 = f.label :review_close_date, 'Review Close Date', class: 'middle' .cell.small-12.medium-9 - = f.text_field :review_close_date, value: grant.review_close_date, disabled: disable_fields, class: 'small-12 medium-4' + = f.text_field :review_close_date, value: grant.review_close_date&.to_fs, disabled: disable_fields, class: 'small-12 medium-4' %h3 Review Settings diff --git a/app/views/profiles/panels/index.html.haml b/app/views/profiles/panels/index.html.haml index cf2f74b2..b6ece628 100644 --- a/app/views/profiles/panels/index.html.haml +++ b/app/views/profiles/panels/index.html.haml @@ -39,6 +39,6 @@ %td = time_tag(grant.review_close_date.end_of_day, grant.review_close_date.end_of_day.to_formatted_s(:date_only)) %td - = grant.panel.start_datetime.present? ? time_tag(grant.panel.start_datetime, grant.panel.start_datetime.to_formatted_s(:default)) : 'Not Scheduled' + = grant.panel.start_datetime.present? ? time_tag(grant.panel.start_datetime, grant.panel.start_datetime.to_fs) : 'Not Scheduled' != pagy_foundation_nav(@pagy_a) diff --git a/config/locales/activerecord/review.yml b/config/locales/activerecord/review.yml index f6091d08..10691d8b 100644 --- a/config/locales/activerecord/review.yml +++ b/config/locales/activerecord/review.yml @@ -17,7 +17,7 @@ en: review: attributes: base: - may_not_review_after_close_date: 'The timeframe for reviews ended on %{review_close_date}' + may_not_review_after_close_date: 'The timeframe for reviews ended on %{review_close_date.to_fs}' assigner: may_not_add_review: 'may not assign submissions reviews on this grant.' reviewer: diff --git a/lib/grant_submission_form_builder.rb b/lib/grant_submission_form_builder.rb index e58484b2..6879446c 100644 --- a/lib/grant_submission_form_builder.rb +++ b/lib/grant_submission_form_builder.rb @@ -34,7 +34,7 @@ def #{method}(*args) def date_opt_time_field(datetime_comp, has_time_component, options = {}) dt_input = @object.class.date_optional_time_attribute(datetime_comp) value = if @object.date_optional_time_errors?(datetime_comp) - @object.get_date_opt_time(datetime_comp, has_time_component).to_s + @object.get_date_opt_time(datetime_comp, has_time_component)&.to_fs else @object.send(dt_input) end diff --git a/spec/factories/grant_submission_response.rb b/spec/factories/grant_submission_response.rb index f134e5c0..bb0a6baf 100644 --- a/spec/factories/grant_submission_response.rb +++ b/spec/factories/grant_submission_response.rb @@ -24,7 +24,7 @@ trait :datetime do association :question, factory: :date_question - datetime_val { DateTime.now.to_s } + datetime_val { DateTime.now.to_fs } end trait :pick_one do diff --git a/spec/models/review_spec.rb b/spec/models/review_spec.rb index 2edbdb03..5b194401 100644 --- a/spec/models/review_spec.rb +++ b/spec/models/review_spec.rb @@ -77,7 +77,7 @@ def random_score it 'prevents a review from being submitted after grant review close date' do grant.update(publish_date: 6.days.ago, submission_open_date: 5.days.ago, submission_close_date: 4.days.ago, review_open_date: 3.days.ago, review_close_date: 2.days.ago) expect(review).not_to be_valid - expect(review.errors.messages[:base]).to include I18n.t('activerecord.errors.models.review.attributes.base.may_not_review_after_close_date', review_close_date: grant.review_close_date) + expect(review.errors.messages[:base]).to include I18n.t('activerecord.errors.models.review.attributes.base.may_not_review_after_close_date', review_close_date: grant.review_close_date.to_fs) end end @@ -125,7 +125,7 @@ def random_score review.update(overall_impact_score: rand(Review::MINIMUM_ALLOWED_SCORE..Review::MAXIMUM_ALLOWED_SCORE)) review.reload expect(review).not_to be_valid - expect(review.errors.messages[:base]).to include I18n.t('activerecord.errors.models.review.attributes.base.may_not_review_after_close_date', review_close_date: grant.review_close_date) + expect(review.errors.messages[:base]).to include I18n.t('activerecord.errors.models.review.attributes.base.may_not_review_after_close_date', review_close_date: grant.review_close_date.to_fs) end end end diff --git a/spec/system/grants/duplicate_spec.rb b/spec/system/grants/duplicate_spec.rb index 316d669f..a783939a 100644 --- a/spec/system/grants/duplicate_spec.rb +++ b/spec/system/grants/duplicate_spec.rb @@ -28,11 +28,11 @@ page.fill_in 'Name', with: "Updated #{grant.name}" page.fill_in 'Short Name', with: "#{grant.slug}1" - page.fill_in 'Publish Date', with: grant.publish_date + 1.day - page.fill_in 'Submission Open Date', with: grant.submission_open_date + 1.day - page.fill_in 'Submission Close Date', with: grant.submission_close_date + 1.day - page.fill_in 'Review Open Date', with: grant.review_open_date + 1.day - page.fill_in 'Review Close Date', with: grant.review_close_date + 1.day + page.fill_in 'Publish Date', with: (grant.publish_date + 1.day).to_fs + page.fill_in 'Submission Open Date', with: (grant.submission_open_date + 1.day).to_fs + page.fill_in 'Submission Close Date', with: (grant.submission_close_date + 1.day).to_fs + page.fill_in 'Review Open Date', with: (grant.review_open_date + 1.day).to_fs + page.fill_in 'Review Close Date', with: (grant.review_close_date + 1.day).to_fs expect do click_button('Save as Draft') @@ -92,11 +92,11 @@ click_link('Duplicate', href: new_grant_duplicate_path(grant)) page.fill_in 'Short Name', with: grant.slug - page.fill_in 'Publish Date', with: grant.publish_date + 1.day - page.fill_in 'Submission Open Date', with: grant.submission_open_date + 1.day - page.fill_in 'Submission Close Date', with: grant.submission_close_date + 1.day - page.fill_in 'Review Open Date', with: grant.review_open_date + 1.day - page.fill_in 'Review Close Date', with: grant.review_close_date + 1.day + page.fill_in 'Publish Date', with: (grant.publish_date + 1.day).to_fs + page.fill_in 'Submission Open Date', with: (grant.submission_open_date + 1.day).to_fs + page.fill_in 'Submission Close Date', with: (grant.submission_close_date + 1.day).to_fs + page.fill_in 'Review Open Date', with: (grant.review_open_date + 1.day).to_fs + page.fill_in 'Review Close Date', with: (grant.review_close_date + 1.day).to_fs expect do click_button('Save as Draft') end.not_to change{ Grant.count } @@ -109,11 +109,11 @@ pause page.fill_in 'Name', with: "Updated #{grant.name}" page.fill_in 'Short Name', with: "#{grant.slug}1" - page.fill_in 'Publish Date', with: grant.publish_date + 1.day - page.fill_in 'Submission Open Date', with: grant.submission_open_date + 1.day - page.fill_in 'Submission Close Date', with: grant.submission_close_date + 1.day - page.fill_in 'Review Open Date', with: grant.review_open_date + 1.day - page.fill_in 'Review Close Date', with: grant.review_close_date + 1.day + page.fill_in 'Publish Date', with: (grant.publish_date + 1.day).to_fs + page.fill_in 'Submission Open Date', with: (grant.submission_open_date + 1.day).to_fs + page.fill_in 'Submission Close Date', with: (grant.submission_close_date + 1.day).to_fs + page.fill_in 'Review Open Date', with: (grant.review_open_date + 1.day).to_fs + page.fill_in 'Review Close Date', with: (grant.review_close_date + 1.day).to_fs expect do click_button('Save as Draft') end.to change{ Grant.count }.by(1).and change{ GrantPermission.count}.by(grant.grant_permissions.count) @@ -161,11 +161,11 @@ pause page.fill_in 'Name', with: "Updated #{grant.name}" page.fill_in 'Short Name', with: "#{grant.slug}1" - page.fill_in 'Publish Date', with: grant.publish_date + 1.day - page.fill_in 'Submission Open Date', with: grant.submission_open_date + 1.day - page.fill_in 'Submission Close Date', with: grant.submission_close_date + 1.day - page.fill_in 'Review Open Date', with: grant.review_open_date + 1.day - page.fill_in 'Review Close Date', with: grant.review_close_date + 1.day + page.fill_in 'Publish Date', with: (grant.publish_date + 1.day).to_fs + page.fill_in 'Submission Open Date', with: (grant.submission_open_date + 1.day).to_fs + page.fill_in 'Submission Close Date', with: (grant.submission_close_date + 1.day).to_fs + page.fill_in 'Review Open Date', with: (grant.review_open_date + 1.day).to_fs + page.fill_in 'Review Close Date', with: (grant.review_close_date + 1.day).to_fs expect do click_button('Save as Draft') expect(1).to eql 1 diff --git a/spec/system/grants/grants_spec.rb b/spec/system/grants/grants_spec.rb index 5265861e..79c2798d 100644 --- a/spec/system/grants/grants_spec.rb +++ b/spec/system/grants/grants_spec.rb @@ -42,13 +42,11 @@ end scenario 'date fields edited with datepicker are properly formatted' do - tomorrow = (Date.current + 1.day).to_s - - expect(page).to have_field('grant_publish_date', with: @grant.publish_date) - page.execute_script("$('#grant_publish_date').fdatepicker('setDate',new Date('#{tomorrow}'))") + tomorrow = (Date.current + 1.day) + expect(page).to have_field('grant_publish_date', with: @grant.publish_date&.to_fs) + page.execute_script("$('#grant_publish_date').fdatepicker('setDate',new Date('#{tomorrow.to_fs}'))") click_button 'Update' - - expect(@grant.reload.publish_date.to_s).to eql(tomorrow) + expect(@grant.reload.publish_date).to eql(tomorrow) end scenario 'versioning tracks whodunnit', versioning: true do @@ -60,7 +58,7 @@ end scenario 'invalid submission', versioning: true do - page.fill_in 'Submission Close Date', with: (@grant.submission_open_date - 1.day) + page.fill_in 'Submission Close Date', with: (@grant.submission_open_date - 1.day).to_fs click_button 'Update' expect(page).to have_content 'Submission Close Date must be after the opening date for submissions.' end @@ -76,13 +74,12 @@ end scenario 'date fields edited with datepicker are properly formatted' do - tomorrow = (Date.current + 1.day).to_s + tomorrow = (Date.current + 1.day) - expect(page).to have_field('grant_publish_date', with: @grant.publish_date) - page.execute_script("$('#grant_publish_date').fdatepicker('setDate',new Date('#{tomorrow}'))") + expect(page).to have_field('grant_publish_date', with: @grant.publish_date.to_fs) + page.execute_script("$('#grant_publish_date').fdatepicker('setDate',new Date('#{tomorrow.to_fs}'))") click_button 'Update' - - expect(@grant.reload.publish_date.to_s).to eql(tomorrow) + expect(@grant.reload.publish_date).to eql(tomorrow) end scenario 'versioning tracks whodunnit', versioning: true do @@ -95,7 +92,7 @@ end scenario 'invalid submission', versioning: true do - page.fill_in 'Submission Close Date', with: (@grant.submission_open_date - 1.day) + page.fill_in 'Submission Close Date', with: (@grant.submission_open_date - 1.day).to_fs click_button 'Update' expect(page).to have_content 'Submission Close Date must be after the opening date for submissions.' end @@ -139,12 +136,12 @@ page.fill_in 'Name', with: @grant.name page.fill_in 'Short Name', with: @grant.slug fill_in_trix_editor('grant_rfa', with: Faker::Lorem.paragraph) - page.fill_in 'Submission Open Date', with: @grant.submission_open_date - page.fill_in 'Submission Close Date', with: @grant.submission_close_date + page.fill_in 'Submission Open Date', with: @grant.submission_open_date.to_fs + page.fill_in 'Submission Close Date', with: @grant.submission_close_date.to_fs page.fill_in 'Maximum Reviewers / Submission', with: @grant.max_reviewers_per_submission page.fill_in 'Maximum Submissions / Reviewer', with: @grant.max_submissions_per_reviewer - page.fill_in 'Review Open Date', with: @grant.review_open_date - page.fill_in 'Review Close Date', with: @grant.review_close_date + page.fill_in 'Review Open Date', with: @grant.review_open_date.to_fs + page.fill_in 'Review Close Date', with: @grant.review_close_date.to_fs end scenario 'default of today for publish date' do @@ -154,7 +151,7 @@ end scenario 'valid form submission creates permissions' do - page.fill_in 'Publish Date', with: @grant.publish_date + page.fill_in 'Publish Date', with: @grant.publish_date.to_fs click_button 'Save as Draft' grant = Grant.last @@ -171,8 +168,8 @@ scenario 'invalid form submission does not create permissions' do grant_permission_count = GrantPermission.all.count - page.fill_in 'Publish Date', with: @grant.publish_date - page.fill_in 'Submission Close Date', with: (@grant.submission_open_date - 1.day) + page.fill_in 'Publish Date', with: @grant.publish_date.to_fs + page.fill_in 'Submission Close Date', with: (@grant.submission_open_date - 1.day).to_fs click_button 'Save as Draft' expect(page).to have_content 'Submission Close Date must be after the opening date for submissions.' expect(GrantPermission.all.count).to eql(grant_permission_count) @@ -229,9 +226,9 @@ it 'displays dates to reviewer' do visit grant_path(grant) expect(page).to have_content 'Panel Start' - expect(page).to have_content grant.panel.start_datetime + expect(page).to have_content grant.panel.start_datetime.to_fs expect(page).to have_content 'Panel End' - expect(page).to have_content grant.panel.end_datetime + expect(page).to have_content grant.panel.end_datetime.to_fs end it 'displays panel link' do @@ -265,9 +262,9 @@ visit grant_path(grant) expect(page).to have_content 'Panel Start' - expect(page).to have_content grant.panel.start_datetime + expect(page).to have_content grant.panel.start_datetime.to_fs expect(page).to have_content 'Panel End' - expect(page).to have_content grant.panel.end_datetime + expect(page).to have_content grant.panel.end_datetime.to_fs end it 'displays panel link' do @@ -301,9 +298,9 @@ visit grant_path(grant) expect(page).to have_content 'Panel Start' - expect(page).to have_content grant.panel.start_datetime + expect(page).to have_content grant.panel.start_datetime.to_fs expect(page).to have_content 'Panel End' - expect(page).to have_content grant.panel.end_datetime + expect(page).to have_content grant.panel.end_datetime.to_fs end it 'displays panel link' do @@ -336,9 +333,9 @@ it 'displays dates' do expect(page).to have_content 'Panel Start' - expect(page).to have_content grant.panel.start_datetime + expect(page).to have_content grant.panel.start_datetime.to_fs expect(page).to have_content 'Panel End' - expect(page).to have_content grant.panel.end_datetime + expect(page).to have_content grant.panel.end_datetime.to_fs end it 'displays panel link' do @@ -418,12 +415,18 @@ visit edit_grant_path(grant) click_link 'Delete' page.driver.browser.switch_to.alert.accept + pause expect(page).to have_content 'Published grant may not be deleted' expect(grant.reload.discarded?).to be false end - pending 'published grant without submissions cannot be discarded' do - fail '#TODO: grant.submissions.count.zero?' + scenario 'published grant without submissions cannot be discarded' do + visit edit_grant_path(grant) + click_link 'Delete' + page.driver.browser.switch_to.alert.accept + pause + expect(page).to have_content 'Published grant may not be deleted' + expect(grant.reload.discarded?).to be false end pending 'delete button hidden when not discardable' do From 3ef14b60ff9edaa7c93cff1ace722bfae035c0dd Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 13:55:36 -0600 Subject: [PATCH 17/25] WIP: update config per previous commit deprecation warning --- config/application.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/config/application.rb b/config/application.rb index b2929cc6..d3fe2069 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,14 +4,19 @@ require 'rails/all' -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(*Rails.groups) - module Competitions class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 + # Update rails to v7.0.8 + # Deprecate passing a format to #to_s in favor of #to_fs + # Fixed as needed. Added config before `Bundler.require` per deprection warning. + ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION'] = "true" + + # Require the gems listed in Gemfile, including any gems + # you've limited to :test, :development, or :production. + Bundler.require(*Rails.groups) + + # Initialize configuration defaults + config.load_defaults 7.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers @@ -32,8 +37,7 @@ class Application < Rails::Application # This suppresses browser messages in console. config.action_dispatch.cookies_same_site_protection = :lax - # Added 1/16/24 - # Update paper_trail to v15.1, review after upgrading to rails 7 + # Update paper_trail to v15.1 # error `Psych::DisallowedClass, Tried to load unspecified class: Time` # Per Rails guide, default setting is [Symbol] config.active_record.yaml_column_permitted_classes = [Symbol, Time] From bb8da086394477f3df2ff073f078dce3f267f75e Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 13:57:35 -0600 Subject: [PATCH 18/25] WIP: Remove last Foundation CSS `abide` reference. After draft submission added, form should submit regardless --- .../grant_submissions/submissions/reviews/_form.html.haml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/views/grant_submissions/submissions/reviews/_form.html.haml b/app/views/grant_submissions/submissions/reviews/_form.html.haml index 36403536..7a0fc404 100644 --- a/app/views/grant_submissions/submissions/reviews/_form.html.haml +++ b/app/views/grant_submissions/submissions/reviews/_form.html.haml @@ -16,10 +16,6 @@ = render partial: 'overall_impact', locals: { f: f, disabled: disabled } - .alert.callout{ style: 'display: none', data: { abide: { error: true } } } - %p - Please check the required scores. - .actions = f.button 'Save as Draft', name: 'review[state]', value: Review::REVIEW_STATES[:draft], type: 'submit', disabled: disabled, data: { confirm: "You are saving this review as a draft. Scores here will not count toward the submission until this review has been submitted. You may submit it until #{grant.review_close_date.to_fs}.", disable_with: 'Please wait'}, class: 'secondary button' = f.button 'Submit Your Review', name: 'review[state]', value: Review::REVIEW_STATES[:submitted], type: 'submit', disabled: disabled, data: { disable_with: "Please wait..." }, class: 'success button' From 900c73a94074834efa8a5e5b347ea3ae2ac88c40 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 13:58:35 -0600 Subject: [PATCH 19/25] WIP: misc formatting, clarification --- app/controllers/application_controller.rb | 2 -- .../responses/_date_opt_time_response.html.haml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6f3852d..f743cbbb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,8 +15,6 @@ class ApplicationController < ActionController::Base protect_from_forgery prepend: true, with: :exception - - def user_for_paper_trail current_user&.id || 'Unauthenticated user' end diff --git a/app/views/grant_submissions/responses/_date_opt_time_response.html.haml b/app/views/grant_submissions/responses/_date_opt_time_response.html.haml index 7aee92c9..1e71cf62 100644 --- a/app/views/grant_submissions/responses/_date_opt_time_response.html.haml +++ b/app/views/grant_submissions/responses/_date_opt_time_response.html.haml @@ -1,4 +1,4 @@ -- if response.datetime_val +- if response.datetime_val.present? = date_mmddyyyy(response.datetime_val) - else .no-response From 901ece51f2cfa02b3359d73ede3fbb5679d170d1 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 14:01:00 -0600 Subject: [PATCH 20/25] WIP: spec fixes, formatting --- spec/models/grant_spec.rb | 30 +++++++++---------- spec/system/banners/banners_spec.rb | 2 +- .../grant_submission_reviews_spec.rb | 16 +++++----- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/spec/models/grant_spec.rb b/spec/models/grant_spec.rb index e4ee7fea..1c877407 100644 --- a/spec/models/grant_spec.rb +++ b/spec/models/grant_spec.rb @@ -197,8 +197,8 @@ end context 'discard' do - it 'is not valid to discard' do - expect(published_not_yet_open.valid?(:discard)).to be false + it 'is not valid to be discarded' do + expect(published_not_yet_open.reload.valid?(:discard)).to be false expect(published_not_yet_open.errors.messages[:base]).to include 'Published grant may not be deleted.' end end @@ -207,10 +207,10 @@ context 'draft grant' do let(:draft_grant) { create(:draft_open_grant_with_users_and_form_and_submission_and_reviewer) } let(:submission) { review.submission } - let!(:review) { create(:review, submission: draft_grant.submissions.first, + let(:review) { create(:review, submission: draft_grant.submissions.first, assigner: draft_grant.admins.first, reviewer: draft_grant.reviewers.first) } - let(:panel) { draft_grant.panel } + let(:panel) { draft_grant.panel } context 'discarding' do it 'is discardable' do @@ -225,27 +225,27 @@ it 'discards associated submission' do expect do draft_grant.discard - end.to change{submission.reload.discarded_at} + end.to change{ submission.reload.discarded_at } end it 'discards associated review' do expect do draft_grant.discard - end.to change{review.reload.discarded_at} + end.to change{ review.reload.discarded_at } end it 'discards associated panel' do expect do draft_grant.discard - end.to change{panel.reload.discarded_at} + end.to change{ panel.reload.discarded_at } end end context '#validations' do context ':discard' do - it 'is not valid' do - expect(draft_grant.valid?(:discard)).to be true - expect(draft_grant.errors.messages[:base]).to be_empty + it 'is valid to be discarded' do + expect(draft_grant.reload.valid?(:discard)).to be true + expect(draft_grant.errors).to be_empty end end end @@ -259,21 +259,21 @@ expect do draft_grant.undiscard end.to change{submission.reload.discarded_at}.to(nil) - .and change{GrantSubmission::Submission.kept.count}.by 1 + .and change{ GrantSubmission::Submission.kept.count }.by 1 end it 'undiscards reviews' do expect do draft_grant.undiscard end.to change{review.reload.discarded_at}.to(nil) - .and change{Review.kept.count}.by 1 + .and change{ Review.kept.count }.by 1 end it 'undiscards panel' do expect do draft_grant.undiscard end.to change{panel.reload.discarded_at}.to(nil) - .and change{Panel.kept.count}.by 1 + .and change{ Panel.kept.count }.by 1 end end end @@ -296,8 +296,8 @@ context '#validations' do context ':discard' do - it 'is not valid' do - expect(completed_grant.valid?(:discard)).to be false + it 'is not valid to be discarded' do + expect(completed_grant.reload.valid?(:discard)).to be false expect(completed_grant.errors.messages[:base]).to include 'Completed grant may not be deleted.' end end diff --git a/spec/system/banners/banners_spec.rb b/spec/system/banners/banners_spec.rb index dff0c6ed..73d58b55 100644 --- a/spec/system/banners/banners_spec.rb +++ b/spec/system/banners/banners_spec.rb @@ -40,7 +40,7 @@ scenario 'displays the Banners link for admins' do page.find('#admin').hover - pause + pause(time: 0.30) expect(page).to have_link 'Banners', href: banners_path click_link 'Banners' expect(current_path).to eq("/banners") diff --git a/spec/system/grant_submissions/grant_submission_reviews_spec.rb b/spec/system/grant_submissions/grant_submission_reviews_spec.rb index 5227f261..607511db 100644 --- a/spec/system/grant_submissions/grant_submission_reviews_spec.rb +++ b/spec/system/grant_submissions/grant_submission_reviews_spec.rb @@ -23,17 +23,17 @@ let(:reviewer3) { create(:grant_reviewer, grant: grant).reviewer } let(:assigned_review) { create(:review, - submission: submission, - assigner: grant_admin, - reviewer: reviewer) } + submission: submission, + assigner: grant_admin, + reviewer: reviewer) } let(:draft_scored_review) { create(:draft_scored_review_with_scored_mandatory_criteria_review, + submission: submission, + assigner: grant_admin, + reviewer: reviewer2) } + let(:submitted_scored_review) { create(:submitted_scored_review_with_scored_mandatory_criteria_review, submission: submission, assigner: grant_admin, - reviewer: reviewer2) } - let(:submitted_scored_review) { create(:submitted_scored_review_with_scored_mandatory_criteria_review, - submission: submission, - assigner: grant_admin, - reviewer: reviewer3) } + reviewer: reviewer3) } let(:unscored_criterion_id) { submitted_scored_review.criteria_reviews.last.criterion.id } def random_score From 64e45f280651184b764e3fe55c6dd69176d4c555 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 14:19:28 -0600 Subject: [PATCH 21/25] Fix draft grant spec on `grant.undiscard` --- spec/models/grant_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/models/grant_spec.rb b/spec/models/grant_spec.rb index 1c877407..fbd02d58 100644 --- a/spec/models/grant_spec.rb +++ b/spec/models/grant_spec.rb @@ -212,6 +212,11 @@ reviewer: draft_grant.reviewers.first) } let(:panel) { draft_grant.panel } + before(:each) do + review.touch + draft_grant.reload + end + context 'discarding' do it 'is discardable' do expect(draft_grant.is_discardable?).to be true From 6d3428c577644a5bdf47e6a11cf56ff87e1bbea8 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 16:23:24 -0600 Subject: [PATCH 22/25] WIP: Remove trix gem in favor of rails native actiontext --- Gemfile | 1 - Gemfile.lock | 3 --- 2 files changed, 4 deletions(-) diff --git a/Gemfile b/Gemfile index 93188c39..dcba6cb5 100644 --- a/Gemfile +++ b/Gemfile @@ -44,7 +44,6 @@ gem 'jquery-ui-rails' gem 'pagy', '~> 6.2.0' gem 'ransack', '~> 3.2.1' gem 'sprockets-es6' -gem 'trix' # audits gem 'discard', '~> 1.3' diff --git a/Gemfile.lock b/Gemfile.lock index 12703916..6619c3eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -419,8 +419,6 @@ GEM tilt (2.3.0) timeliness (0.4.5) timeout (0.4.1) - trix (0.10.1) - rails turbo-rails (1.4.0) actionpack (>= 6.0.0) activejob (>= 6.0.0) @@ -518,7 +516,6 @@ DEPENDENCIES spring-watcher-listen (~> 2.1.0) sprockets-es6 terser (~> 1.1) - trix turbo-rails (~> 1.4.0) tzinfo-data validates_timeliness (= 7.0.0.beta2) From 1a1968cd67fefeb281b5dade82c1ff73eac636c0 Mon Sep 17 00:00:00 2001 From: jseraf Date: Fri, 19 Jan 2024 16:23:46 -0600 Subject: [PATCH 23/25] WIP: actiontext:install --- app/assets/stylesheets/actiontext.css | 35 ++++++++++++++++++ app/assets/stylesheets/actiontext.scss | 36 ------------------- app/assets/stylesheets/application.scss | 2 -- app/javascript/application.js | 3 +- .../action_text/contents/_content.html.erb | 3 ++ package.json | 4 +-- spec/rails_helper.rb | 13 ++++--- spec/spec_helper.rb | 20 +++++------ yarn.lock | 27 ++++++++------ 9 files changed, 74 insertions(+), 69 deletions(-) create mode 100644 app/assets/stylesheets/actiontext.css delete mode 100644 app/assets/stylesheets/actiontext.scss create mode 100644 app/views/layouts/action_text/contents/_content.html.erb diff --git a/app/assets/stylesheets/actiontext.css b/app/assets/stylesheets/actiontext.css new file mode 100644 index 00000000..b7e9e585 --- /dev/null +++ b/app/assets/stylesheets/actiontext.css @@ -0,0 +1,35 @@ +/* + * Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and + * the trix-editor content (whether displayed or under editing). Feel free to incorporate this + * inclusion directly in any other asset bundle and remove this file. + * + *= require trix +*/ + +/* + * We need to override trix.css’s image gallery styles to accommodate the + * element we wrap around attachments. Otherwise, + * images in galleries will be squished by the max-width: 33%; rule. +*/ +.trix-content .attachment-gallery > action-text-attachment, +.trix-content .attachment-gallery > .attachment { + flex: 1 0 33%; + padding: 0 0.5em; + max-width: 33%; +} + +.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment, +.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment, +.trix-content .attachment-gallery.attachment-gallery--4 > .attachment { + flex-basis: 50%; + max-width: 50%; +} + +.trix-content action-text-attachment .attachment { + padding: 0 !important; + max-width: 100% !important; +} + +.trix-button-group--file-tools { + display: none !important; +} diff --git a/app/assets/stylesheets/actiontext.scss b/app/assets/stylesheets/actiontext.scss deleted file mode 100644 index 7cb26e74..00000000 --- a/app/assets/stylesheets/actiontext.scss +++ /dev/null @@ -1,36 +0,0 @@ -// -// Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and -// the trix-editor content (whether displayed or under editing). Feel free to incorporate this -// inclusion directly in any other asset bundle and remove this file. -// -//= require trix/dist/trix - -// We need to override trix.css’s image gallery styles to accommodate the -// element we wrap around attachments. Otherwise, -// images in galleries will be squished by the max-width: 33%; rule. -.trix-content { - .attachment-gallery { - > action-text-attachment, - > .attachment { - flex: 1 0 33%; - padding: 0 0.5em; - max-width: 33%; - } - - &.attachment-gallery--2, - &.attachment-gallery--4 { - > action-text-attachment, - > .attachment { - flex-basis: 50%; - max-width: 50%; - } - } - } - - action-text-attachment { - .attachment { - padding: 0 !important; - max-width: 100% !important; - } - } -} diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 869224aa..1f3195fd 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -19,7 +19,5 @@ @import "app"; @import "foundation_and_overrides"; @import "foundation-datepicker"; -@import "trix/dist/trix"; -@import "./actiontext.scss"; @import "font-awesome"; @import "./jquery-ui.css"; diff --git a/app/javascript/application.js b/app/javascript/application.js index 6ae269bf..13a03c49 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -11,7 +11,6 @@ import "motion-ui" import "./src/vendor/jquery-ui" import "jquery_nested_form" import "@nathanvda/cocoon" -import "trix" import "@rails/actiontext" import "foundation-sites" import "foundation-datepicker" @@ -32,3 +31,5 @@ require('./src/legacy/form_builder_standard_answer') require('./src/legacy/form_builder_survey') require('./src/legacy/form_builder_upload_setup') require('./src/legacy/foundation-datepicker') +import "trix" +import "@rails/actiontext" diff --git a/app/views/layouts/action_text/contents/_content.html.erb b/app/views/layouts/action_text/contents/_content.html.erb new file mode 100644 index 00000000..9e3c0d0d --- /dev/null +++ b/app/views/layouts/action_text/contents/_content.html.erb @@ -0,0 +1,3 @@ +
+ <%= yield -%> +
diff --git a/package.json b/package.json index b86c3bb5..e9a4286e 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@hotwired/turbo-rails": "^7.2.4", "@nathanvda/cocoon": "^1.2.14", "@rails/actioncable": "^6.0.0", - "@rails/actiontext": "^6.1.4-1", + "@rails/actiontext": "^7.1.3", "@rails/activestorage": "^6.0.0", "@rails/request.js": "^0.0.8", "@rails/ujs": "^6.0.0", @@ -25,7 +25,7 @@ "motion-ui": "^2.0.3", "select2": "^4.1.0-rc.0", "tom-select": "^2.2.2", - "trix": "^1.3.1" + "trix": "^2.0.8" }, "scripts": { "build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds" diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a4aa72e4..e6f223ee 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,15 +1,14 @@ -# frozen_string_literal: true - # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' +require_relative '../config/environment' + require 'simplecov' SimpleCov.start 'rails' -require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production -abort('The Rails environment is running in production mode!') if Rails.env.production? +abort("The Rails environment is running in production mode!") if Rails.env.production? require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! require 'active_support' @@ -20,7 +19,7 @@ require 'pundit/rspec' require 'pundit/matchers' require 'paper_trail/frameworks/rspec' -Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } +Rails.root.glob('spec/support/**/*.rb').sort.each { |f| require f } Capybara.register_driver :selenium_chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end @@ -45,12 +44,12 @@ begin ActiveRecord::Migration.maintain_test_schema! rescue ActiveRecord::PendingMigrationError => e - puts e.to_s.strip + abort e.to_s.strip exit 1 end RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - # config.fixture_path = "#{::Rails.root}/spec/fixtures" + # config.fixture_path = Rails.root.join('spec/fixtures') # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 48edb28b..5545b3a3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause @@ -14,7 +12,7 @@ # the additional setup, and require it from the spec files that actually need # it. # -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest @@ -46,11 +44,6 @@ # triggering implicit auto-inclusion in groups with matching metadata. config.shared_context_metadata_behavior = :apply_to_host_groups - # Allows RSpec to persist some state between runs in order to support - # the `--only-failures` and `--next-failure` CLI options. We recommend - # you configure your source control system to ignore this file. - config.example_status_persistence_file_path = "spec/examples.txt" - # The settings below are suggested to provide a good initial experience # with RSpec, but feel free to customize to your heart's content. =begin @@ -60,12 +53,17 @@ # aliases for `it`, `describe`, and `context` that include `:focus` # metadata: `fit`, `fdescribe` and `fcontext`, respectively. config.filter_run_when_matching :focus +=end + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + +=begin # Limits the available syntax to the non-monkey patched syntax that is # recommended. For more details, see: - # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ - # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ config.disable_monkey_patching! # Many RSpec users commonly either run the entire suite or an individual diff --git a/yarn.lock b/yarn.lock index f9781855..dfde93da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -54,12 +54,19 @@ resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.0.4.tgz#70a3ca56809f7aaabb80af2f9c01ae51e1a8ed41" integrity sha512-tz4oM+Zn9CYsvtyicsa/AwzKZKL+ITHWkhiu7x+xF77clh2b4Rm+s6xnOgY/sGDWoFWZmtKsE95hxBPkgQQNnQ== -"@rails/actiontext@^6.1.4-1": - version "6.1.4-1" - resolved "https://registry.yarnpkg.com/@rails/actiontext/-/actiontext-6.1.4-1.tgz#c75fbeeb7860c2f508150ad003c0c0d0c97c7584" - integrity sha512-dS7AdkJtSyuX2PXipCTNOKEg5G/ftwS+FmM5+8Zxbo35tgs08hfYFPh0muoj5eEkshwV67kEEV/iHgX8PMLh4w== +"@rails/actiontext@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@rails/actiontext/-/actiontext-7.1.3.tgz#1b7aa2732c45cbc8a5708c54457c16fb81ce3da3" + integrity sha512-jwY0LJ0xpyIWkYs6BUMY4RcwVA3jZ+bFDPvv5KpKQnw+24BhJVtBLqF0XIsROaRCyabakueRyVuSG9NNhnLTvA== dependencies: - "@rails/activestorage" "^6.0.0" + "@rails/activestorage" ">= 7.1.0-alpha" + +"@rails/activestorage@>= 7.1.0-alpha": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-7.1.3.tgz#e83ece6c5fd94b3ddf30a8cf3b8f78cad049e596" + integrity sha512-B+RFYAU8vdTPFg0IJcRp2ey0Qw9hpcUOqHHcWqftDJ76ZMBi9+m/UUeMJlNsSd0l9eD+1HLlFSo1X//cY4yiDw== + dependencies: + spark-md5 "^3.0.1" "@rails/activestorage@^6.0.0": version "6.1.4" @@ -216,7 +223,7 @@ select2@^4.1.0-rc.0: resolved "https://registry.yarnpkg.com/select2/-/select2-4.1.0-rc.0.tgz#ba3cd3901dda0155e1c0219ab41b74ba51ea22d8" integrity sha512-Hr9TdhyHCZUtwznEH2CBf7967mEM0idtJ5nMtjvk3Up5tPukOLXbHUNmh10oRfeNIhj+3GD3niu+g6sVK+gK0A== -spark-md5@^3.0.0: +spark-md5@^3.0.0, spark-md5@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz#7952c4a30784347abcee73268e473b9c0167e3fc" integrity sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw== @@ -229,7 +236,7 @@ tom-select@^2.2.2: "@orchidjs/sifter" "^1.0.3" "@orchidjs/unicode-variants" "^1.0.4" -trix@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/trix/-/trix-1.3.1.tgz#ccce8d9e72bf0fe70c8c019ff558c70266f8d857" - integrity sha512-BbH6mb6gk+AV4f2as38mP6Ucc1LE3OD6XxkZnAgPIduWXYtvg2mI3cZhIZSLqmMh9OITEpOBCCk88IVmyjU7bA== +trix@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/trix/-/trix-2.0.8.tgz#6fff81b9e02c4f60a181febb3f6e862fbb98f1c4" + integrity sha512-tPqJl+NjALVUOC8sNfRrY42K7cfp4QBb9svXxmfhxYrspF9fOOzXq+GnDa9l2ZAcfM43msnPpkJ7MrJQA3FgrA== From 67411ddecbec936980e39d2a07ae0c72522765a0 Mon Sep 17 00:00:00 2001 From: jseraf Date: Wed, 24 Jan 2024 10:02:10 -0600 Subject: [PATCH 24/25] WIP: to 7.0.8, configs, specs pass --- bin/rails | 7 +- bin/rake | 5 +- bin/setup | 26 ++- config/application.rb | 24 ++- config/boot.rb | 7 +- config/environment.rb | 4 +- config/environments/development.rb | 46 +++-- config/environments/test.rb | 26 ++- config/initializers/assets.rb | 7 +- .../initializers/content_security_policy.rb | 46 +++-- .../initializers/filter_parameter_logging.rb | 10 +- config/initializers/inflections.rb | 10 +- .../new_framework_defaults_6_0.rb | 45 ----- config/initializers/permissions_policy.rb | 11 ++ ...e_storage_blobs_checksum.active_storage.rb | 8 + db/schema.rb | 157 +++++++++--------- 16 files changed, 215 insertions(+), 224 deletions(-) delete mode 100644 config/initializers/new_framework_defaults_6_0.rb create mode 100644 config/initializers/permissions_policy.rb create mode 100644 db/migrate/20240123171240_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb diff --git a/bin/rails b/bin/rails index a31728ab..55d52160 100755 --- a/bin/rails +++ b/bin/rails @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -# frozen_string_literal: true -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index c1999550..4b052d66 100755 --- a/bin/rake +++ b/bin/rake @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -# frozen_string_literal: true -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index ac9f6246..76c6e517 100755 --- a/bin/setup +++ b/bin/setup @@ -1,38 +1,36 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -require 'fileutils' +require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end FileUtils.chdir APP_ROOT do - # This script is a way to setup or update your development environment automatically. - # This script is idempotent, so that you can run it at anytime and get an expectable outcome. + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # Install JavaScript dependencies # system('bin/yarn') # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/config/application.rb b/config/application.rb index d3fe2069..c1e726e1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require_relative 'boot' require 'rails/all' @@ -9,38 +7,36 @@ class Application < Rails::Application # Update rails to v7.0.8 # Deprecate passing a format to #to_s in favor of #to_fs # Fixed as needed. Added config before `Bundler.require` per deprection warning. - ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION'] = "true" + # ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION'] = "true" + # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) - # Initialize configuration defaults + # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 - # Settings in config/environments/* take precedence over those specified here. + # Configuration for the application, engines, and railties goes here. + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. # config.autoload_paths << Rails.root.join('lib') - config.eager_load_paths << "#{config.root}/lib" + config.eager_load_paths << Rails.root.join("lib") # Recursively load locale files # Allows for organized, model-specific translation files config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] - # Specify cookies SameSite protection level: either :none, :lax, or :strict. - # This change is not backwards compatible with earlier Rails versions. - # It's best enabled when your entire app is migrated and stable on 6.1. - # Was not in Rails 6.0. Default in rails 6.1 is :lax, not :strict - # This suppresses browser messages in console. - config.action_dispatch.cookies_same_site_protection = :lax - - # Update paper_trail to v15.1 + # Update paper_trail to v15.1, Rails 7 # error `Psych::DisallowedClass, Tried to load unspecified class: Time` # Per Rails guide, default setting is [Symbol] config.active_record.yaml_column_permitted_classes = [Symbol, Time] + + config.active_support.disable_to_s_conversion = true end end diff --git a/config/boot.rb b/config/boot.rb index c04863fa..7bd23080 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,5 @@ -# frozen_string_literal: true +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +require "bundler/setup" # Set up gems listed in the Gemfile. -require 'bundler/setup' # Set up gems listed in the Gemfile. -require 'bootsnap/setup' # Speed up boot time by caching expensive operations. +require "bootsnap/setup" # Speed up boot time by caching expensive operations. diff --git a/config/environment.rb b/config/environment.rb index 45084b6b..e31fe6fc 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,5 @@ -# frozen_string_literal: true - # Load the Rails application. -require_relative 'application' +require_relative "application" # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 3768eab8..875d9dd0 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,10 @@ -# frozen_string_literal: true +require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -14,14 +14,18 @@ # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp', 'caching-dev.txt').exist? + if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true + config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" + "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -35,27 +39,41 @@ # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true + # 1/23/24 - commented config as part of upgrade 6.1 -> 7.0 + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + # config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - config.file_watcher = ActiveSupport::EventedFileUpdateChecker - config.reload_classes_only_on_change = true + # 1/23/24 - commented config as part of upgrade 6.1 -> 7.0 + # # Use an evented file watcher to asynchronously detect changes in source code, + # # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + # config.reload_classes_only_on_change = true # Time zone config.time_zone = 'Central Time (US & Canada)' diff --git a/config/environments/test.rb b/config/environments/test.rb index 4e54060b..9bc88176 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -8,18 +8,20 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + # Turn false under Spring and add config.action_view.cache_template_loading = true. config.cache_classes = false config.action_view.cache_template_loading = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + # config.eager_load = ENV["CI"].present? config.eager_load = true # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. @@ -41,6 +43,9 @@ # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. + # config.action_mailer.delivery_method = :test + + # 1/23/24 - Remove if specs pass, no mailer errors in test suite, etd config.action_mailer.default_url_options = { host: COMPETITIONS_CONFIG[:default_url_options][:host], port: COMPETITIONS_CONFIG[:default_url_options][:port] } config.action_mailer.delivery_method = COMPETITIONS_CONFIG[:mailer][:delivery_method].to_sym @@ -48,10 +53,19 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true # Time zone config.time_zone = 'Central Time (US & Canada)' config.active_record.default_timezone = :local + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 72408ea0..08d49aa7 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,12 +1,13 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path + +# 1/23/24 - Removed in rails update 6.1 -> 7.0 +# Still needed? # Add Yarn node_modules folder to the asset load path. Rails.application.config.assets.paths << Rails.root.join('node_modules') diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 9c49284a..226fba08 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -2,31 +2,27 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https -# # If you are using webpack-dev-server then specify webpack-dev-server host -# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true # end -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 7a4f47b4..9eccbc6e 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,8 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. +Rails.application.config.filter_parameters += [ + :password +] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index b029afd1..39f7c230 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,20 +1,18 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end ActiveSupport::Inflector.inflections(:en) do |inflect| diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb deleted file mode 100644 index 4e92d679..00000000 --- a/config/initializers/new_framework_defaults_6_0.rb +++ /dev/null @@ -1,45 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 6.0 upgrade. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. - -# Don't force requests from old versions of IE to be UTF-8 encoded. -# Rails.application.config.action_view.default_enforce_utf8 = false - -# Embed purpose and expiry metadata inside signed and encrypted -# cookies for increased security. -# -# This option is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.0. -Rails.application.config.action_dispatch.use_cookies_with_metadata = true - -# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification. -Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false - -# Return false instead of self when enqueuing is aborted from a callback. -# Rails.application.config.active_job.return_false_on_aborted_enqueue = true - -# Send Active Storage analysis and purge jobs to dedicated queues. -Rails.application.config.active_storage.queues.analysis = :active_storage_analysis -Rails.application.config.active_storage.queues.purge = :active_storage_purge - -# When assigning to a collection of attachments declared via `has_many_attached`, replace existing -# attachments instead of appending. Use #attach to add new attachments without replacing existing ones. -Rails.application.config.active_storage.replace_on_assign_to_many = true - -# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. -# -# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), -# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. -# If you send mail in the background, job workers need to have a copy of -# MailDeliveryJob to ensure all delivery jobs are processed properly. -# Make sure your entire app is migrated and stable on 6.0 before using this setting. -Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" - -# Enable the same cache key to be reused when the object being cached of type -# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count) -# of the relation's cache key into the cache version to support recycling cache key. -Rails.application.config.active_record.collection_cache_versioning = true diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb new file mode 100644 index 00000000..00f64d71 --- /dev/null +++ b/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/db/migrate/20240123171240_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20240123171240_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 00000000..93c8b85a --- /dev/null +++ b/db/migrate/20240123171240_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,8 @@ +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/db/schema.rb b/db/schema.rb index 6ae0c855..91b1cd26 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_09_29_200356) do - +ActiveRecord::Schema[7.0].define(version: 2024_01_23_171240) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -20,8 +19,8 @@ t.text "body" t.string "record_type", null: false t.bigint "record_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end @@ -30,7 +29,7 @@ t.string "record_type", null: false t.bigint "record_id", null: false t.bigint "blob_id", null: false - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end @@ -41,8 +40,8 @@ t.string "content_type" t.text "metadata" t.bigint "byte_size", null: false - t.string "checksum", null: false - t.datetime "created_at", null: false + t.string "checksum" + t.datetime "created_at", precision: nil, null: false t.string "service_name", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end @@ -59,8 +58,8 @@ t.string "action", null: false t.string "browser" t.string "params" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["controller", "action"], name: "index_audit_actions_on_controller_and_action" t.index ["user_id", "action"], name: "index_audit_actions_on_user_id_and_action" t.index ["user_id", "controller"], name: "index_audit_actions_on_user_id_and_controller" @@ -72,7 +71,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["item_id"], name: "index_banner_versions_on_item_id" t.index ["whodunnit"], name: "index_banner_versions_on_whodunnit" end @@ -80,8 +79,8 @@ create_table "banners", force: :cascade do |t| t.text "body" t.boolean "visible", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "criteria", force: :cascade do |t| @@ -90,8 +89,8 @@ t.text "description" t.boolean "is_mandatory", default: true, null: false t.boolean "show_comment_field", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["grant_id"], name: "index_criteria_on_grant_id" end @@ -102,7 +101,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["item_id"], name: "index_criteria_review_versions_on_item_id" t.index ["review_id"], name: "index_criteria_review_versions_on_review_id" t.index ["whodunnit"], name: "index_criteria_review_versions_on_whodunnit" @@ -113,8 +112,8 @@ t.bigint "review_id" t.integer "score" t.text "comment" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["criterion_id"], name: "index_criteria_reviews_on_criterion_id" t.index ["review_id"], name: "index_criteria_reviews_on_review_id" end @@ -126,7 +125,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id"], name: "index_criterion_versions_on_grant_id" t.index ["item_id"], name: "index_criterion_versions_on_item_id" t.index ["whodunnit"], name: "index_criterion_versions_on_whodunnit" @@ -139,7 +138,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["item_id"], name: "index_grant_creator_request_versions_on_item_id" t.index ["requester_id"], name: "index_grant_creator_request_versions_on_requester_id" t.index ["whodunnit"], name: "index_grant_creator_request_versions_on_whodunnit" @@ -151,8 +150,8 @@ t.string "status", default: "pending", null: false t.bigint "reviewer_id" t.text "review_comment" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["status"], name: "index_grant_creator_requests_on_status" end @@ -164,7 +163,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id"], name: "index_grant_permission_versions_on_grant_id" t.index ["item_id"], name: "index_grant_permission_versions_on_item_id" t.index ["user_id"], name: "index_grant_permission_versions_on_user_id" @@ -175,8 +174,8 @@ t.bigint "grant_id" t.bigint "user_id" t.string "role" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.boolean "submission_notification", default: false, null: false t.boolean "contact", default: false, null: false t.index ["grant_id"], name: "index_grant_permissions_on_grant_id" @@ -191,7 +190,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["email"], name: "index_grant_reviewer_invitation_versions_on_email" t.index ["grant_id"], name: "index_grant_reviewer_invitation_versions_on_grant_id" t.index ["item_id"], name: "index_grant_reviewer_invitation_versions_on_item_id" @@ -203,11 +202,11 @@ t.bigint "invited_by_id", null: false t.bigint "invitee_id" t.string "email", null: false - t.datetime "confirmed_at" - t.datetime "reminded_at" - t.datetime "opted_out_at" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "confirmed_at", precision: nil + t.datetime "reminded_at", precision: nil + t.datetime "opted_out_at", precision: nil + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["email"], name: "index_grant_reviewer_invitations_on_email" t.index ["grant_id", "email"], name: "index_grant_reviewer_invitations_on_grant_id_and_email", unique: true t.index ["grant_id", "invited_by_id"], name: "index_grant_reviewer_invitations_on_grant_id_and_invited_by_id" @@ -222,7 +221,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id"], name: "index_grant_reviewer_versions_on_grant_id" t.index ["item_id"], name: "index_grant_reviewer_versions_on_item_id" t.index ["reviewer_id"], name: "index_grant_reviewer_versions_on_reviewer_id" @@ -243,7 +242,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id"], name: "index_grant_submission_form_versions_on_grant_id" t.index ["item_id"], name: "index_grant_submission_form_versions_on_item_id" t.index ["whodunnit"], name: "index_grant_submission_form_versions_on_whodunnit" @@ -254,8 +253,8 @@ t.string "submission_instructions", limit: 3000 t.bigint "created_id" t.bigint "updated_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["grant_id"], name: "index_grant_submission_forms_on_grant_id", unique: true end @@ -266,7 +265,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_submission_question_id"], name: "i_gsmcov_on_question_id" t.index ["item_id"], name: "i_gsmcov_on_item_id" t.index ["whodunnit"], name: "i_gsmcov_on_whodunnit" @@ -276,8 +275,8 @@ t.bigint "grant_submission_question_id", null: false t.string "text", null: false t.integer "display_order", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["display_order", "grant_submission_question_id"], name: "i_smco_on_display_order_and_submission_question_id", unique: true t.index ["grant_submission_question_id"], name: "i_gsmco_on_submission_question_id" t.index ["text", "grant_submission_question_id"], name: "i_smco_on_text_and_submission_question_id", unique: true @@ -290,7 +289,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_submission_section_id"], name: "index_gsqv_on_section_id" t.index ["item_id"], name: "index_gsqv_on_item_id" t.index ["whodunnit"], name: "index_gsqv_on_whodunnit" @@ -304,8 +303,8 @@ t.string "export_code" t.boolean "is_mandatory" t.string "response_type", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["display_order", "grant_submission_section_id"], name: "i_sqs_on_display_order_and_submission_section_id", unique: true t.index ["grant_submission_section_id"], name: "index_grant_submission_questions_on_grant_submission_section_id" t.index ["text", "grant_submission_section_id"], name: "i_gsq_on_text_and_grant_submission_section_id", unique: true @@ -318,7 +317,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_submission_question_id"], name: "index_gsrv_on_question_id" t.index ["item_id"], name: "index_gsrv_on_item_id" t.index ["whodunnit"], name: "index_gsrv_on_whodunnit" @@ -331,10 +330,10 @@ t.string "string_val" t.text "text_val" t.decimal "decimal_val" - t.datetime "datetime_val" + t.datetime "datetime_val", precision: nil t.boolean "boolean_val" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["grant_submission_multiple_choice_option_id"], name: "i_gsr_on_submission_multiple_choice_option_id" t.index ["grant_submission_question_id", "grant_submission_submission_id"], name: "i_gsr_on_submissisubmission_id", unique: true t.index ["grant_submission_question_id"], name: "i_gsr_on_grant_submission_question_id" @@ -348,7 +347,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_submission_form_id"], name: "index_gssv_on_form_id" t.index ["item_id"], name: "index_gssv_on_item_id" t.index ["whodunnit"], name: "index_gssv_on_whodunnit" @@ -358,8 +357,8 @@ t.bigint "grant_submission_form_id", null: false t.string "title" t.integer "display_order", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["display_order", "grant_submission_form_id"], name: "i_submission_sections_on_display_order_and_submission_form_id", unique: true t.index ["grant_submission_form_id"], name: "index_grant_submission_sections_on_grant_submission_form_id" end @@ -372,7 +371,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["applicant_id"], name: "index_gs_submission_applicant_v_on_applicant_id" t.index ["grant_submission_submission_id"], name: "index_gs_submission_applicant_v_on_submission_id" t.index ["item_id"], name: "index_gs_submission_applicant_v_on_item_id" @@ -382,9 +381,9 @@ create_table "grant_submission_submission_applicants", force: :cascade do |t| t.bigint "grant_submission_submission_id", null: false t.bigint "applicant_id", null: false - t.datetime "deleted_at" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "deleted_at", precision: nil + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["applicant_id"], name: "index_grant_submission_submission_applicants_on_applicant_id" t.index ["grant_submission_submission_id"], name: "i_gssa_on_grant_submission_submission_id" end @@ -397,7 +396,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id", "submitter_id"], name: "index_gs_submission_v_on_grant_id_submitter_id" t.index ["grant_id"], name: "index_gs_submission_v_on_grant_id" t.index ["item_id"], name: "index_gs_submission_v_on_item_id" @@ -409,12 +408,12 @@ t.bigint "grant_submission_form_id", null: false t.bigint "created_id", null: false t.string "title", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "reviews_count", default: 0 t.string "state", null: false - t.datetime "user_updated_at" - t.datetime "discarded_at" + t.datetime "user_updated_at", precision: nil + t.datetime "discarded_at", precision: nil t.decimal "average_overall_impact_score", precision: 5, scale: 2 t.decimal "composite_score", precision: 5, scale: 2 t.boolean "awarded", default: false, null: false @@ -432,7 +431,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["item_type", "item_id"], name: "index_grant_versions_on_item_type_and_item_id" t.index ["whodunnit"], name: "index_grant_versions_on_whodunnit" end @@ -451,9 +450,9 @@ t.integer "max_submissions_per_reviewer" t.date "review_open_date" t.date "review_close_date" - t.datetime "discarded_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "discarded_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["discarded_at"], name: "index_grants_on_discarded_at" t.index ["slug"], name: "index_grants_on_slug" end @@ -465,7 +464,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id"], name: "index_panel_versions_on_grant_id" t.index ["item_id"], name: "index_panel_versions_on_item_id" t.index ["whodunnit"], name: "index_panel_versions_on_whodunnit" @@ -473,14 +472,14 @@ create_table "panels", force: :cascade do |t| t.bigint "grant_id", null: false - t.datetime "start_datetime" - t.datetime "end_datetime" + t.datetime "start_datetime", precision: nil + t.datetime "end_datetime", precision: nil t.text "instructions" t.string "meeting_link" t.text "meeting_location" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "discarded_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.datetime "discarded_at", precision: nil t.boolean "show_review_comments", default: false, null: false t.index ["discarded_at"], name: "index_panels_on_discarded_at" t.index ["grant_id"], name: "index_panels_on_grant_id" @@ -494,7 +493,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["grant_id"], name: "index_review_versions_on_grant_id" t.index ["item_id"], name: "index_review_versions_on_item_id" t.index ["whodunnit"], name: "index_review_versions_on_whodunnit" @@ -506,10 +505,10 @@ t.bigint "reviewer_id", null: false t.integer "overall_impact_score" t.text "overall_impact_comment" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "discarded_at" - t.datetime "reminded_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.datetime "discarded_at", precision: nil + t.datetime "reminded_at", precision: nil t.string "state", default: "assigned", null: false t.index ["discarded_at"], name: "index_reviews_on_discarded_at" t.index ["grant_submission_submission_id", "reviewer_id"], name: "index_review_reviewer_on_grant_submission_id_and_assigner_id", unique: true @@ -524,7 +523,7 @@ t.string "event", null: false t.integer "whodunnit" t.text "object" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.index ["item_id"], name: "index_user_versions_on_item_id" t.index ["whodunnit"], name: "index_user_versions_on_whodunnit" end @@ -534,11 +533,11 @@ t.string "first_name" t.string "last_name" t.string "era_commons" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" + t.datetime "current_sign_in_at", precision: nil + t.datetime "last_sign_in_at", precision: nil t.inet "current_sign_in_ip" t.inet "last_sign_in_ip" t.boolean "system_admin", default: false, null: false @@ -547,10 +546,10 @@ t.string "type" t.string "encrypted_password", default: "", null: false t.string "reset_password_token" - t.datetime "reset_password_sent_at" + t.datetime "reset_password_sent_at", precision: nil t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.datetime "confirmed_at", precision: nil + t.datetime "confirmation_sent_at", precision: nil t.string "unconfirmed_email" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true From b949d10528f84c2d838db919460341b534dcd2c9 Mon Sep 17 00:00:00 2001 From: jseraf Date: Thu, 25 Jan 2024 08:49:05 -0600 Subject: [PATCH 25/25] WIP: Add comment re Date#to_s deprecation and paper_trail --- config/application.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index c1e726e1..8a923604 100644 --- a/config/application.rb +++ b/config/application.rb @@ -5,9 +5,13 @@ module Competitions class Application < Rails::Application # Update rails to v7.0.8 - # Deprecate passing a format to #to_s in favor of #to_fs - # Fixed as needed. Added config before `Bundler.require` per deprection warning. - # ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION'] = "true" + # Deprecate passing a date to #to_s in favor of #to_fs + # Updated in views as needed. + # Added before `Bundler.require` per deprection warning. + # Note: PaperTrail (v15.1) entries with date(s) still show the following deprecation + # `DEPRECATION WARNING: Using a :default format for Date#to_s is deprecated. + # Please use Date#to_fs instead.` + ENV['RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION'] = "true" # Require the gems listed in Gemfile, including any gems