diff --git a/.rubocop.yml b/.rubocop.yml index 40e239f3..1152536f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,14 +1,12 @@ -require: - - rubocop-rspec_rails - plugins: - rubocop-factory_bot - rubocop-performance - rubocop-rspec - rubocop-rails + - rubocop-rspec_rails AllCops: - TargetRailsVersion: 7.0 + TargetRailsVersion: 7.1 TargetRubyVersion: 3.3 Exclude: - 'db/schema.rb' @@ -33,9 +31,6 @@ Metrics/BlockLength: - 'config/routes.rb' - 'spec/**/*' -Layout/LineLength: - Max: 100 - Metrics/MethodLength: Exclude: - 'db/migrate/*' diff --git a/Dockerfile b/Dockerfile index da18b0e6..226103ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apk add --update \ tzdata \ libffi-dev \ build-base \ + yaml-dev \ && rm -rf /var/cache/apk/* RUN mkdir /app diff --git a/Gemfile b/Gemfile index abbaa157..40783fd9 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,6 @@ gem 'carrierwave', '~> 3.1', '>= 3.1.1' gem 'carrierwave-base64', '~> 2.11' gem 'carrierwave-bombshelter', '~> 0.2', '>= 0.2.2' gem 'case_transform', '~> 0.2' -gem 'concurrent-ruby', '1.3.4' # can be removed when we upgrade to rails 7.1 https://www.devgem.io/posts/resolving-the-loggerthreadsafelevel-error-in-rails-after-bundle-update gem 'counter_culture', '~> 3.8', '>= 3.8.2' gem 'doorkeeper', '~> 5.8', '>= 5.8.1' gem 'doorkeeper-i18n', '~> 5.2', '>= 5.2.7' @@ -30,7 +29,7 @@ gem 'puma', '~> 6.6' gem 'pundit', '~> 2.5' gem 'rack-attack', '~> 6.7' gem 'rack-cors', '~> 2.0', '>= 2.0.2', require: 'rack/cors' -gem 'rails', '~> 7.0.0', '>= 7.0.8.7' +gem 'rails', '~> 7.1.0', '>= 7.1.5.1' gem 'rails-i18n', '~> 7.0', '>= 7.0.10' gem 'redis', '~> 5.4' gem 'roo', '~> 2.10', '>= 2.10.1' @@ -48,7 +47,7 @@ gem 'vpim', '~> 24.2', '>= 24.2.20' group :development, :test do gem 'awesome_print' gem 'brakeman', require: false - gem 'bullet' + gem 'bullet', '~> 7.2' gem 'colorize' gem 'consistency_fail' gem 'dotenv-rails' @@ -73,13 +72,13 @@ end group :test do gem 'guard-rspec', require: false - gem 'rspec-rails' + gem 'rspec-rails', '~> 6.1', '>= 6.1.5' gem 'rubocop', '~> 1.73', '>= 1.73.2', require: false gem 'rubocop-factory_bot', '~> 2.27', require: false gem 'rubocop-performance', '~> 1.24', '>= 1.24.0', require: false gem 'rubocop-rails', '~> 2.30', '>= 2.30.3', require: false gem 'rubocop-rspec', '~> 3.5', '>= 3.5.0', require: false - gem 'rubocop-rspec_rails', '~> 2.30', '>= 2.30.0', require: false + gem 'rubocop-rspec_rails', '~> 2.31', require: false gem 'simplecov', require: false gem 'simplecov-lcov', '~> 0.8.0', require: false gem 'terminal-notifier-guard' diff --git a/Gemfile.lock b/Gemfile.lock index 10ebd6d2..2980d8ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,73 +1,85 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) + actioncable (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.7) - actionpack (= 7.0.8.7) - activejob (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + zeitwerk (~> 2.6) + actionmailbox (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.7) - actionpack (= 7.0.8.7) - actionview (= 7.0.8.7) - activejob (= 7.0.8.7) - activesupport (= 7.0.8.7) + actionmailer (7.1.5.1) + actionpack (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activesupport (= 7.1.5.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.7) - actionview (= 7.0.8.7) - activesupport (= 7.0.8.7) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.5.1) + actionview (= 7.1.5.1) + activesupport (= 7.1.5.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.7) - actionpack (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.5.1) + actionpack (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.7) - activesupport (= 7.0.8.7) + actionview (7.1.5.1) + activesupport (= 7.1.5.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_model_otp (2.3.4) activemodel rotp (~> 6.3.0) - activejob (7.0.8.7) - activesupport (= 7.0.8.7) + activejob (7.1.5.1) + activesupport (= 7.1.5.1) globalid (>= 0.3.6) - activemodel (7.0.8.7) - activesupport (= 7.0.8.7) - activerecord (7.0.8.7) - activemodel (= 7.0.8.7) - activesupport (= 7.0.8.7) - activestorage (7.0.8.7) - actionpack (= 7.0.8.7) - activejob (= 7.0.8.7) - activerecord (= 7.0.8.7) - activesupport (= 7.0.8.7) + activemodel (7.1.5.1) + activesupport (= 7.1.5.1) + activerecord (7.1.5.1) + activemodel (= 7.1.5.1) + activesupport (= 7.1.5.1) + timeout (>= 0.4.0) + activestorage (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activesupport (= 7.1.5.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.7) + activesupport (7.1.5.1) + base64 + benchmark (>= 0.3) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) @@ -77,19 +89,20 @@ GEM bcrypt (3.1.20) bcrypt (3.1.20-java) benchmark (0.4.0) - better_errors (2.9.1) - coderay (>= 1.0.0) + better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) + rouge (>= 1.0.0) bigdecimal (3.1.9) bigdecimal (3.1.9-java) - binding_of_caller (1.0.0) - debug_inspector (>= 0.0.1) + binding_of_caller (1.0.1) + debug_inspector (>= 1.2.0) bootsnap (1.18.4) msgpack (~> 1.2) - brakeman (5.2.3) + brakeman (7.0.0) + racc builder (3.3.0) - bullet (7.0.0) + bullet (7.2.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) @@ -111,43 +124,44 @@ GEM case_transform (0.2) activesupport coderay (1.1.3) - colorize (0.8.1) + colorize (1.1.0) concurrent-ruby (1.3.4) connection_pool (2.5.0) consistency_fail (0.3.7) counter_culture (3.8.2) activerecord (>= 4.2) activesupport (>= 4.2) - crack (0.4.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) date (3.4.1) date (3.4.1-java) - debug_inspector (1.1.0) - diff-lcs (1.5.0) - docile (1.4.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + debug_inspector (1.2.0) + diff-lcs (1.6.0) + docile (1.4.1) + domain_name (0.6.20240107) doorkeeper (5.8.1) railties (>= 5) doorkeeper-i18n (5.2.7) doorkeeper (>= 5.2) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) - railties (>= 3.2) - erubi (1.13.0) + dotenv (3.1.7) + dotenv-rails (3.1.7) + dotenv (= 3.1.7) + railties (>= 6.1) + drb (2.2.1) + erubi (1.13.1) et-orbi (1.2.11) tzinfo exifr (1.4.1) - factory_bot (6.2.1) - activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) + factory_bot (6.5.1) + activesupport (>= 6.1.0) + factory_bot_rails (6.4.4) + factory_bot (~> 6.5) railties (>= 5.0.0) faker (3.5.1) i18n (>= 1.8.11, < 2) - fastimage (2.2.6) + fastimage (2.4.0) ffi (1.17.1) ffi-compiler (1.3.2) ffi (>= 1.15.5) @@ -163,12 +177,14 @@ GEM ruby-progressbar (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) - guard (2.18.0) + guard (2.19.1) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) + logger (~> 1.6) lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) + ostruct (~> 0.6) pry (>= 0.13.0) shellany (~> 0.0) thor (>= 0.18.1) @@ -177,7 +193,7 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - hashdiff (1.0.1) + hashdiff (1.1.2) http (5.2.0) addressable (~> 2.8) base64 (~> 0.1) @@ -185,7 +201,7 @@ GEM http-form_data (~> 2.2) llhttp-ffi (~> 0.5.0) http-accept (1.7.0) - http-cookie (1.0.4) + http-cookie (1.0.8) domain_name (~> 0.5) http-form_data (2.3.0) i18n (1.14.7) @@ -200,8 +216,15 @@ GEM ruby-vips (>= 2.0.17, < 3) improvmx (0.2.1) rest-client (~> 2.0) + io-console (0.8.0) + io-console (0.8.0-java) + irb (1.15.1) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) isbn_validation (1.2.2) activerecord (>= 3) + jar-dependencies (0.5.5) json (2.10.1) json (2.10.1-java) jsonapi-authorization (3.0.2) @@ -213,17 +236,17 @@ GEM railties (>= 4.1) language_server-protocol (3.17.0.4) lint_roller (1.1.0) - listen (3.7.1) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) llhttp-ffi (0.5.0) ffi-compiler (~> 1.0) rake (~> 13.0) - logger (1.6.5) - loofah (2.23.1) + logger (1.6.6) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lumberjack (1.2.8) + lumberjack (1.2.10) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -233,11 +256,11 @@ GEM message_bus (4.3.9) rack (>= 1.1.3) method_source (1.1.0) - mime-types (3.4.1) + mime-types (3.6.0) + logger mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mina (1.2.4) - open4 (~> 1.3.4) + mime-types-data (3.2025.0304) + mina (1.2.5) rake mini_magick (5.2.0) benchmark @@ -245,8 +268,9 @@ GEM mini_mime (1.1.5) mini_portile2 (2.8.8) minitest (5.25.4) - msgpack (1.7.5) - msgpack (1.7.5-java) + msgpack (1.8.0) + msgpack (1.8.0-java) + mutex_m (0.3.0) nenv (0.3.0) net-imap (0.5.6) date @@ -260,13 +284,14 @@ GEM netrc (0.11.0) nio4r (2.7.4) nio4r (2.7.4-java) - nokogiri (1.16.7) + nokogiri (1.18.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) + nokogiri (1.18.3-java) + racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - open4 (1.3.4) ostruct (0.6.1) paper_trail (16.0.0) activerecord (>= 6.1) @@ -278,7 +303,10 @@ GEM ast (~> 2.4.1) racc pg (1.5.9) - phonelib (0.6.58) + phonelib (0.10.5) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -291,6 +319,12 @@ GEM pry (>= 0.13, < 0.15) pry-rails (0.3.11) pry (>= 0.13.0) + psych (5.2.3) + date + stringio + psych (5.2.3-java) + date + jar-dependencies (>= 0.1.7) public_suffix (6.0.1) puma (6.6.0) nio4r (~> 2.0) @@ -301,57 +335,67 @@ GEM raabro (1.4.0) racc (1.8.1) racc (1.8.1-java) - rack (2.2.11) + rack (2.2.12) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (2.0.2) rack (>= 2.0.0) - rack-mini-profiler (3.0.0) + rack-mini-profiler (3.3.1) rack (>= 1.2.0) - rack-test (2.1.0) + rack-session (1.0.2) + rack (< 3) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.7) - actioncable (= 7.0.8.7) - actionmailbox (= 7.0.8.7) - actionmailer (= 7.0.8.7) - actionpack (= 7.0.8.7) - actiontext (= 7.0.8.7) - actionview (= 7.0.8.7) - activejob (= 7.0.8.7) - activemodel (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.1.5.1) + actioncable (= 7.1.5.1) + actionmailbox (= 7.1.5.1) + actionmailer (= 7.1.5.1) + actionpack (= 7.1.5.1) + actiontext (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activemodel (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) bundler (>= 1.15.0) - railties (= 7.0.8.7) + railties (= 7.1.5.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails-i18n (7.0.10) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) - method_source + railties (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rb-fsevent (0.11.1) - rb-inotify (0.10.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) ffi (~> 1.0) rb-readline (0.5.5) + rdoc (6.12.0) + psych (>= 4.0.0) redis (5.4.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.24.0) connection_pool regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) rest-client (2.1.0) @@ -382,27 +426,28 @@ GEM nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) rotp (6.3.0) - 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) + rouge (4.5.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.3) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-rails (5.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) + rspec-support (~> 3.13.0) + rspec-rails (6.1.5) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.2) rubocop (1.73.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) @@ -414,7 +459,7 @@ GEM rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.38.0) + rubocop-ast (1.38.1) parser (>= 3.3.1.0) rubocop-factory_bot (2.27.0) lint_roller (~> 1.1) @@ -432,17 +477,19 @@ GEM rubocop-rspec (3.5.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) - rubocop-rspec_rails (2.30.0) - rubocop (~> 1.61) - rubocop-rspec (~> 3, >= 3.0.1) + rubocop-rspec_rails (2.31.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec (~> 3.5) ruby-filemagic (0.7.3) ruby-progressbar (1.13.0) - ruby-vips (2.2.2) + ruby-vips (2.2.3) ffi (~> 1.12) logger rubyzip (2.4.1) rufus-scheduler (3.9.2) fugit (~> 1.1, >= 1.11.1) + securerandom (0.4.1) sentry-rails (5.22.4) railties (>= 5.0) sentry-ruby (~> 5.22.4) @@ -467,38 +514,33 @@ GEM rufus-scheduler (~> 3.2) sidekiq (>= 6, < 8) tilt (>= 1.4.0, < 3) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) spoon (0.0.6) ffi - spring (2.1.1) + spring (4.2.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - spring-watcher-listen (2.0.1) + spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) + spring (>= 4) ssrf_filter (1.2.0) + stringio (3.1.5) terminal-notifier-guard (1.7.0) thor (1.3.2) - tilt (2.4.0) - timecop (0.9.5) - timeliness (0.5.1) + tilt (2.6.0) + timecop (0.9.10) + timeliness (0.5.2) timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2022.1) + tzinfo-data (1.2025.1) tzinfo (>= 1.0.0) - unf (0.1.4) - unf_ext - unf (0.1.4-java) - unf_ext (0.0.8.1) - unf_ext (0.0.8.1-x64-mingw32) - unf_ext (0.0.8.1-x86-mingw32) unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) @@ -506,12 +548,14 @@ GEM validates_timeliness (7.1.0) activemodel (>= 7.0.0, < 8) timeliness (>= 0.3.10, < 1) - vcr (6.1.0) + vcr (6.3.1) + base64 vpim (24.2.20) - webmock (3.14.0) + webmock (3.25.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) websocket-driver (0.7.7) base64 websocket-extensions (>= 0.1.0) @@ -519,7 +563,7 @@ GEM base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.18) + zeitwerk (2.7.2) PLATFORMS java @@ -536,13 +580,12 @@ DEPENDENCIES binding_of_caller bootsnap (~> 1.18, >= 1.18.4) brakeman - bullet + bullet (~> 7.2) carrierwave (~> 3.1, >= 3.1.1) carrierwave-base64 (~> 2.11) carrierwave-bombshelter (~> 0.2, >= 0.2.2) case_transform (~> 0.2) colorize - concurrent-ruby (= 1.3.4) consistency_fail counter_culture (~> 3.8, >= 3.8.2) doorkeeper (~> 5.8, >= 5.8.1) @@ -576,18 +619,18 @@ DEPENDENCIES rack-attack (~> 6.7) rack-cors (~> 2.0, >= 2.0.2) rack-mini-profiler - rails (~> 7.0.0, >= 7.0.8.7) + rails (~> 7.1.0, >= 7.1.5.1) rails-i18n (~> 7.0, >= 7.0.10) rb-readline redis (~> 5.4) roo (~> 2.10, >= 2.10.1) - rspec-rails + rspec-rails (~> 6.1, >= 6.1.5) rubocop (~> 1.73, >= 1.73.2) rubocop-factory_bot (~> 2.27) rubocop-performance (~> 1.24, >= 1.24.0) rubocop-rails (~> 2.30, >= 2.30.3) rubocop-rspec (~> 3.5, >= 3.5.0) - rubocop-rspec_rails (~> 2.30, >= 2.30.0) + rubocop-rspec_rails (~> 2.31) ruby-filemagic (~> 0.7, >= 0.7.3) rubyzip (~> 2.4, >= 2.4.1) sentry-rails (~> 5.22, >= 5.22.4) diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb index 147857f2..1dba2076 100644 --- a/app/controllers/v1/users_controller.rb +++ b/app/controllers/v1/users_controller.rb @@ -84,7 +84,7 @@ def nextcloud groups: nextcloud_groups } end - def batch_import # rubocop:disable Metrics/MethodLength, Metrics/AbcSize + def batch_import # rubocop:disable Metrics/AbcSize authorize model_class file = decode_upload_file(params['file']) @@ -93,9 +93,7 @@ def batch_import # rubocop:disable Metrics/MethodLength, Metrics/AbcSize import = Import::User.new(file, group) - unless import.valid? - return render json: { errors: import.errors }, status: :unprocessable_entity - end + return render json: { errors: import.errors }, status: :unprocessable_entity unless import.valid? import.save!(live_run) render json: { users: import.imported_users.to_json(except: excluded_display_properties), diff --git a/app/helpers/camo_helper.rb b/app/helpers/camo_helper.rb index 508a913a..23b0d9e7 100644 --- a/app/helpers/camo_helper.rb +++ b/app/helpers/camo_helper.rb @@ -1,7 +1,7 @@ module CamoHelper # See https://github.com/ankane/camo/blob/master/lib/camo.rb def camo(image_url) - hexdigest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), + hexdigest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), Rails.application.config.x.camo_key, image_url) encoded_image_url = image_url.unpack1('H*') "#{Rails.application.config.x.camo_host}/#{hexdigest}/#{encoded_image_url}" diff --git a/app/jobs/mail_moderation_reminder_job.rb b/app/jobs/mail_moderation_reminder_job.rb index 65fa9b71..5bb36b69 100644 --- a/app/jobs/mail_moderation_reminder_job.rb +++ b/app/jobs/mail_moderation_reminder_job.rb @@ -10,8 +10,6 @@ def perform(stored_mail_id) MailModerationMailer.reminder_for_moderation_email(moderator, stored_mail).deliver_later end - unless Rails.env.development? - MailModerationReminderJob.set(wait: 24.hours).perform_later(stored_mail_id) - end + MailModerationReminderJob.set(wait: 24.hours).perform_later(stored_mail_id) unless Rails.env.development? end end diff --git a/app/models/import/transaction.rb b/app/models/import/transaction.rb index 411e8902..205b8d6b 100644 --- a/app/models/import/transaction.rb +++ b/app/models/import/transaction.rb @@ -22,9 +22,7 @@ def import! def valid?(file) headers = get_headers(file) - unless headers.include?('username') - @errors.add(:import_file, 'username field must be present') - end + @errors.add(:import_file, 'username field must be present') unless headers.include?('username') headers.include?('username') end diff --git a/app/resources/v1/application_resource.rb b/app/resources/v1/application_resource.rb index 9dc43232..74419db8 100644 --- a/app/resources/v1/application_resource.rb +++ b/app/resources/v1/application_resource.rb @@ -43,7 +43,7 @@ def self.search(records, value) value.each do |val| val.split.each do |word| records = records.where( - searchable_fields.map { |field| arel[field].lower.matches("%#{word.downcase}%") }.inject(:or) # rubocop:disable Layout/LineLength + searchable_fields.map { |field| arel[field].lower.matches("%#{word.downcase}%") }.inject(:or) ) end end diff --git a/app/resources/v1/form/form_resource.rb b/app/resources/v1/form/form_resource.rb index ccc26448..8754517c 100644 --- a/app/resources/v1/form/form_resource.rb +++ b/app/resources/v1/form/form_resource.rb @@ -20,9 +20,7 @@ def current_user_response_completed end def self.records(options = {}) - if options[:context][:action] == 'index' - options[:includes] = %i[responses open_questions closed_questions] - end + options[:includes] = %i[responses open_questions closed_questions] if options[:context][:action] == 'index' super end diff --git a/app/resources/v1/form/response_resource.rb b/app/resources/v1/form/response_resource.rb index aa16300c..0b932c88 100644 --- a/app/resources/v1/form/response_resource.rb +++ b/app/resources/v1/form/response_resource.rb @@ -8,9 +8,7 @@ class V1::Form::ResponseResource < V1::ApplicationResource has_many :closed_question_answers, always_include_linkage_data: true def self.records(options = {}) - if options[:context][:action] == 'index' - options[:includes] = %i[open_question_answers closed_question_answers] - end + options[:includes] = %i[open_question_answers closed_question_answers] if options[:context][:action] == 'index' super end diff --git a/app/resources/v1/user_resource.rb b/app/resources/v1/user_resource.rb index bd0e08c7..5782f475 100644 --- a/app/resources/v1/user_resource.rb +++ b/app/resources/v1/user_resource.rb @@ -32,9 +32,7 @@ def avatar_thumb_url upcoming_birthdays = records.upcoming_birthdays records.find_each do |record| context[:model] = record - unless read_user_details?(context) - upcoming_birthdays = upcoming_birthdays.where.not(id: record.id) - end + upcoming_birthdays = upcoming_birthdays.where.not(id: record.id) unless read_user_details?(context) end upcoming_birthdays } diff --git a/app/validators/not_renullable_validator.rb b/app/validators/not_renullable_validator.rb index 069fa701..47c9c1f2 100644 --- a/app/validators/not_renullable_validator.rb +++ b/app/validators/not_renullable_validator.rb @@ -4,8 +4,6 @@ def validate_each(record, attribute, _value) return unless changed - if !changed[0].nil? && changed[1].nil? - record.errors.add(attribute, 'changed from not-nil to nil') - end + record.errors.add(attribute, 'changed from not-nil to nil') if !changed[0].nil? && changed[1].nil? end end diff --git a/bin/setup b/bin/setup index 0e39e8cb..451efe2e 100755 --- a/bin/setup +++ b/bin/setup @@ -4,13 +4,13 @@ require 'fileutils' # path to your application root. APP_ROOT = File.expand_path('..', __dir__) -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") +def system!(*) + system(*, exception: true) 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 ==' diff --git a/config/application.rb b/config/application.rb index 56f01904..af909dbd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,5 +1,4 @@ require_relative 'boot' - require 'rails' require 'active_model/railtie' require 'active_job/railtie' @@ -8,11 +7,7 @@ require 'action_controller/railtie' require 'action_mailer/railtie' require 'action_mailbox/engine' -# require "action_text/engine" # require "action_view/railtie" -# require "action_cable/engine" -# require "sprockets/railtie" -# require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -23,10 +18,19 @@ class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 - # Settings in config/environments/* take precedence over those specified here. - # 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.add_autoload_paths_to_load_path = false + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w[assets tasks]) + + # 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. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") # Only loads a smaller set of middleware suitable for API only apps. # Middleware like session, flash, cookies can be added back manually. diff --git a/config/brakeman.ignore b/config/brakeman.ignore index 7b69468c..e6e759e6 100644 --- a/config/brakeman.ignore +++ b/config/brakeman.ignore @@ -1,20 +1,5 @@ { "ignored_warnings": [ - { - "warning_type": "Session Setting", - "warning_code": 29, - "fingerprint": "715ad9c0d76f57a6a657192574d528b620176a80fec969e2f63c88eacab0b984", - "message": "Session secret should not be included in version control", - "file": "config/initializers/secret_token.rb", - "line": 19, - "link": "http://brakemanscanner.org/docs/warning_types/session_setting/", - "code": null, - "render_path": null, - "location": null, - "user_input": null, - "confidence": "High", - "note": "" - } ], "updated": "2016-06-03 22:39:14 +0200", "brakeman_version": "3.3.1" diff --git a/config/environments/development.rb b/config/environments/development.rb index 99e21f44..ac8c6c66 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,12 @@ +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 + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -12,6 +14,9 @@ # 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? @@ -36,14 +41,29 @@ # 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 + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = 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 + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = false # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. diff --git a/config/environments/production.rb b/config/environments/production.rb index 9c23bed4..f7eae182 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,11 +1,8 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # Require master key for secrets - config.require_master_key = true - # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers @@ -14,19 +11,19 @@ config.eager_load = true # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true + # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment + # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). + config.require_master_key = true - # Disable serving static files from the `/public` folder by default since + # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache @@ -35,21 +32,32 @@ # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. + # config.assume_ssl = true + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. + # Log to STDOUT by default + config.logger = ActiveSupport::Logger.new($stdout) + .tap { |logger| logger.formatter = Logger::Formatter.new } + .then { |logger| ActiveSupport::TaggedLogging.new(logger) } config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [:request_id] + # "info" includes generic and useful information about system operation, but avoids logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). If you + # want to log everything, set the level to "debug". + config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info') + # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque + # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "amber_production" config.action_mailer.perform_caching = false @@ -63,24 +71,19 @@ config.i18n.fallbacks = true # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = Logger::Formatter.new - - # Use a different logger for distributed setups. - # require 'syslog/logger' - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') - - if ENV['RAILS_LOG_TO_STDOUT'].present? - logger = ActiveSupport::Logger.new($stdout) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end + config.active_support.report_deprecations = :notify # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } + config.cache_store = :redis_cache_store, { url: Rails.application.config_for(:cable)['url'] } # Refer to the front end of AMBER (Ember) diff --git a/config/environments/test.rb b/config/environments/test.rb index 5af3cbbc..4d012f33 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -25,7 +25,7 @@ config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + config.action_dispatch.show_exceptions = :none # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -43,9 +43,21 @@ # 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 + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = false + # Configure url to test actionmailer urls config.action_mailer.default_url_options = { scheme: 'http', host: 'testhost', port: 1337 } config.active_job.queue_adapter = :test diff --git a/config/initializers/faker.rb b/config/initializers/faker.rb index 3b78d942..75a9ea91 100644 --- a/config/initializers/faker.rb +++ b/config/initializers/faker.rb @@ -1 +1 @@ -Faker::Config.locale = 'nl' if Rails.env.development? || Rails.env.test? +Faker::Config.locale = 'nl' if Rails.env.local? diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e..262e8620 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,8 @@ # 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 partially matched (e.g. passw matches password) and 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 += %i[ + passw secret token _key crypt salt certificate otp ssn +] diff --git a/config/initializers/new_framework_defaults_7_1.rb b/config/initializers/new_framework_defaults_7_1.rb new file mode 100644 index 00000000..c0158740 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_1.rb @@ -0,0 +1,256 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.1 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.1`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able +# to manually require files that are managed by the autoloader, which you shouldn't do anyway. +# +# This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size +# of the bootsnap cache if you use it. +# +# To set this configuration, add the following line to `config/application.rb` (NOT this file): +# config.add_autoload_paths_to_load_path = false + +### +# Remove the default X-Download-Options headers since it is used only by Internet Explorer. +# If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`. +#++ +Rails.application.config.action_dispatch.default_headers = { + 'X-Frame-Options' => 'SAMEORIGIN', + 'X-XSS-Protection' => '0', + 'X-Content-Type-Options' => 'nosniff', + 'X-Permitted-Cross-Domain-Policies' => 'none', + 'Referrer-Policy' => 'strict-origin-when-cross-origin' +} + +### +# Do not treat an `ActionController::Parameters` instance +# as equal to an equivalent `Hash` by default. +#++ +Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false + +### +# Active Record Encryption now uses SHA-256 as its hash digest algorithm. +# +# There are 3 scenarios to consider. +# +# 1. If you have data encrypted with previous Rails versions, and you have +# +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default +# before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too: +#++ +# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1 +# +# 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default +# in 7.0), then you need to configure SHA-256 for Active Record Encryption: +#++ +# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256 +# +# 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to +# configure the default behavior starting 7.1+: +#++ +Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false + +### +# No longer run after_commit callbacks on the first of multiple Active Record +# instances to save changes to the same database row within a transaction. +# Instead, run these callbacks on the instance most likely to have internal +# state which matches what was committed to the database, typically the last +# instance to save. +#++ +Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false + +### +# Configures SQLite with a strict strings mode, which disables double-quoted string literals. +# +# SQLite has some quirks around double-quoted string literals. +# It first tries to consider double-quoted strings as identifier names, but if they don't exist +# it then considers them as string literals. Because of this, typos can silently go unnoticed. +# For example, it is possible to create an index for a non existing column. +# See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details. +#++ +Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true + +### +# Disable deprecated singular associations names. +#++ +Rails.application.config.active_record.allow_deprecated_singular_associations_name = false + +### +# Enable the Active Job `BigDecimal` argument serializer, which guarantees +# roundtripping. Without this serializer, some queue adapters may serialize +# `BigDecimal` arguments as simple (non-roundtrippable) strings. +# +# When deploying an application with multiple replicas, old (pre-Rails 7.1) +# replicas will not be able to deserialize `BigDecimal` arguments from this +# serializer. Therefore, this setting should only be enabled after all replicas +# have been successfully upgraded to Rails 7.1. +#++ +Rails.application.config.active_job.use_big_decimal_serializer = true + +### +# Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or +# `write` are given an invalid `expires_at` or `expires_in` time. +# Options are `true`, and `false`. If `false`, the exception will be reported +# as `handled` and logged instead. +#++ +Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true + +### +# Specify whether Query Logs will format tags using the SQLCommenter format +# (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format. +# Options are `:legacy` and `:sqlcommenter`. +#++ +Rails.application.config.active_record.query_log_tags_format = :sqlcommenter + +### +# Specify the default serializer used by `MessageEncryptor` and `MessageVerifier` +# instances. +# +# The legacy default is `:marshal`, which is a potential vector for +# deserialization attacks in cases where a message signing secret has been +# leaked. +# +# In Rails 7.1, the new default is `:json_allow_marshal` which serializes and +# deserializes with `ActiveSupport::JSON`, but can fall back to deserializing +# with `Marshal` so that legacy messages can still be read. +# +# In Rails 7.2, the default will become `:json` which serializes and +# deserializes with `ActiveSupport::JSON` only. +# +# Alternatively, you can choose `:message_pack` or `:message_pack_allow_marshal`, +# which serialize with `ActiveSupport::MessagePack`. `ActiveSupport::MessagePack` +# can roundtrip some Ruby types that are not supported by JSON, and may provide +# improved performance, but it requires the `msgpack` gem. +# +# For more information, see +# https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer +# +# If you are performing a rolling deploy of a Rails 7.1 upgrade, wherein servers +# that have not yet been upgraded must be able to read messages from upgraded +# servers, first deploy without changing the serializer, then set the serializer +# in a subsequent deploy. +#++ +Rails.application.config.active_support.message_serializer = :json_allow_marshal + +### +# Enable a performance optimization that serializes message data and metadata +# together. This changes the message format, so messages serialized this way +# cannot be read by older versions of Rails. However, messages that use the old +# format can still be read, regardless of whether this optimization is enabled. +# +# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have +# not yet been upgraded must be able to read messages from upgraded servers, +# leave this optimization off on the first deploy, then enable it on a +# subsequent deploy. +#++ +Rails.application.config.active_support.use_message_serializer_for_metadata = true + +### +# Set the maximum size for Rails log files. +# +# `config.load_defaults 7.1` does not set this value for environments other than +# development and test. +#++ +Rails.application.config.log_file_size = 100 * 1024 * 1024 if Rails.env.local? + +### +# Enable raising on assignment to attr_readonly attributes. The previous +# behavior would allow assignment but silently not persist changes to the +# database. +#++ +Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true + +### +# Enable validating only parent-related columns for presence when the parent is mandatory. +# The previous behavior was to validate the presence of the parent record, which performed an extra query +# to get the parent every time the child record was updated, even when parent has not changed. +#++ +Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false + +### +# Enable precompilation of `config.filter_parameters`. Precompilation can +# improve filtering performance, depending on the quantity and types of filters. +#++ +Rails.application.config.precompile_filter_parameters = true + +### +# Enable before_committed! callbacks on all enrolled records in a transaction. +# The previous behavior was to only run the callbacks on the first copy of a record +# if there were multiple copies of the same record enrolled in the transaction. +#++ +Rails.application.config.active_record.before_committed_on_all_records = true + +### +# Disable automatic column serialization into YAML. +# To keep the historic behavior, you can set it to `YAML`, however it is +# recommended to explicitly define the serialization method for each column +# rather than to rely on a global default. +#++ +Rails.application.config.active_record.default_column_serializer = nil + +### +# Enable a performance optimization that serializes Active Record models +# in a faster and more compact way. +# +# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have +# not yet been upgraded must be able to read caches from upgraded servers, +# leave this optimization off on the first deploy, then enable it on a +# subsequent deploy. +#++ +# Rails.application.config.active_record.marshalling_format_version = 7.1 + +### +# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model. +# This matches the behaviour of all other callbacks. +# In previous versions of Rails, they ran in the inverse order. +#++ +Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true + +### +# Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`. +#++ +Rails.application.config.active_record.commit_transaction_on_non_local_return = true + +### +# Controls when to generate a value for has_secure_token declarations. +#++ +Rails.application.config.active_record.generate_secure_token_on = :initialize + +### +# ** Please read carefully, this must be configured in config/application.rb ** +# +# Change the format of the cache entry. +# +# Changing this default means that all new cache entries added to the cache +# will have a different format that is not supported by Rails 7.0 +# applications. +# +# Only change this value after your application is fully deployed to Rails 7.1 +# and you have no plans to rollback. +# When you're ready to change format, add this to `config/application.rb` (NOT +# this file): +# config.active_support.cache_format_version = 7.1 + +### +# Configure the log level used by the DebugExceptions middleware when logging +# uncaught exceptions during requests. +#++ +Rails.application.config.action_dispatch.debug_exception_log_level = :error + +### +# Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5 +# parsers. +# +# Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4. +# +# In previous versions of Rails, these test helpers always used an HTML4 parser. +#++ +Rails.application.config.dom_testing_default_html_version = :html5 diff --git a/db/migrate/20250310235232_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20250310235232_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 00000000..93c8b85a --- /dev/null +++ b/db/migrate/20250310235232_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/migrate/20250206102023_tomato_to_sofia.rb b/db/migrate/archive/20250206102023_tomato_to_sofia.rb similarity index 100% rename from db/migrate/20250206102023_tomato_to_sofia.rb rename to db/migrate/archive/20250206102023_tomato_to_sofia.rb diff --git a/db/migrate/20250207233328_remove_contact_sync.rb b/db/migrate/archive/20250207233328_remove_contact_sync.rb similarity index 100% rename from db/migrate/20250207233328_remove_contact_sync.rb rename to db/migrate/archive/20250207233328_remove_contact_sync.rb diff --git a/db/migrate/20250216233318_remove_null_option_boolean.rb b/db/migrate/archive/20250216233318_remove_null_option_boolean.rb similarity index 96% rename from db/migrate/20250216233318_remove_null_option_boolean.rb rename to db/migrate/archive/20250216233318_remove_null_option_boolean.rb index d84e2181..4524a9fc 100644 --- a/db/migrate/20250216233318_remove_null_option_boolean.rb +++ b/db/migrate/archive/20250216233318_remove_null_option_boolean.rb @@ -1,5 +1,5 @@ class RemoveNullOptionBoolean < ActiveRecord::Migration[7.0] - # rubocop:disable Rails/ReversibleMigration, Rails/BulkChangeTable, Metrics/AbcSize, Layout/LineLength + # rubocop:disable Rails/ReversibleMigration, Rails/BulkChangeTable, Metrics/AbcSize def change execute 'UPDATE static_pages SET publicly_visible = false WHERE publicly_visible IS NULL' execute 'UPDATE users SET sidekiq_access = false WHERE sidekiq_access IS NULL' @@ -34,5 +34,5 @@ def change change_column_default :room_adverts, :publicly_visible, false change_column_null :room_adverts, :publicly_visible, false end - # rubocop:enable Rails/ReversibleMigration, Rails/BulkChangeTable, Metrics/AbcSize, Layout/LineLength + # rubocop:enable Rails/ReversibleMigration, Rails/BulkChangeTable, Metrics/AbcSize end diff --git a/db/migrate/20250218204807_add_be_rijbewijs.rb b/db/migrate/archive/20250218204807_add_be_rijbewijs.rb similarity index 100% rename from db/migrate/20250218204807_add_be_rijbewijs.rb rename to db/migrate/archive/20250218204807_add_be_rijbewijs.rb diff --git a/db/migrate/20250219195453_remove_unique_index_from_form_responses.rb b/db/migrate/archive/20250219195453_remove_unique_index_from_form_responses.rb similarity index 100% rename from db/migrate/20250219195453_remove_unique_index_from_form_responses.rb rename to db/migrate/archive/20250219195453_remove_unique_index_from_form_responses.rb diff --git a/db/schema.rb b/db/schema.rb index 2c4aaf6c..20015070 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2025_02_19_195453) do +ActiveRecord::Schema[7.1].define(version: 2025_03_10_235232) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -39,7 +39,7 @@ t.string "content_type" t.text "metadata" t.bigint "byte_size", null: false - t.string "checksum", 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 diff --git a/spec/helpers/camo_helper_spec.rb b/spec/helpers/camo_helper_spec.rb index 420832a7..c66a9d39 100644 --- a/spec/helpers/camo_helper_spec.rb +++ b/spec/helpers/camo_helper_spec.rb @@ -5,7 +5,7 @@ describe '#camo' do it do expect(camo('http://example.org/image.jpg')).to eq( - 'https://example.org/c7125941763fc18c9d8977ed19028ca5f9378070/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067' + 'https://example.org/d87bfef52ecbfda9b5319a1d7818fd53c4d119f2b0205cb7f8538860ac357cb0/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067' ) end end diff --git a/spec/helpers/markdown_helper_spec.rb b/spec/helpers/markdown_helper_spec.rb index 96a71bb5..2408c7c3 100644 --- a/spec/helpers/markdown_helper_spec.rb +++ b/spec/helpers/markdown_helper_spec.rb @@ -7,62 +7,62 @@ it do expect(camofy("plain text \n ![alt text](http://example.org/image.jpg)")).to eq( - "plain text \n ![alt text](https://example.org/c7125941763fc18c9d8977ed19028ca5f9378070/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067)" + "plain text \n ![alt text](https://example.org/d87bfef52ecbfda9b5319a1d7818fd53c4d119f2b0205cb7f8538860ac357cb0/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067)" ) end it do expect(camofy('plain text ![](http://example.org/image.jpg)')).to eq( - 'plain text ![](https://example.org/c7125941763fc18c9d8977ed19028ca5f9378070/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067)' + 'plain text ![](https://example.org/d87bfef52ecbfda9b5319a1d7818fd53c4d119f2b0205cb7f8538860ac357cb0/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067)' ) end # rubocop:disable Layout/LineLength it do expect(camofy('![](http://example.org/image.jpg "Image title")')).to eq( - '![](https://example.org/c7125941763fc18c9d8977ed19028ca5f9378070/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067 "Image title")' + '![](https://example.org/d87bfef52ecbfda9b5319a1d7818fd53c4d119f2b0205cb7f8538860ac357cb0/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067 "Image title")' ) end it do expect(camofy('![](http://example.org/image.jpg =100x* "Image title")')).to eq( - '![](https://example.org/c7125941763fc18c9d8977ed19028ca5f9378070/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067 =100x* "Image title")' + '![](https://example.org/d87bfef52ecbfda9b5319a1d7818fd53c4d119f2b0205cb7f8538860ac357cb0/687474703a2f2f6578616d706c652e6f72672f696d6167652e6a7067 =100x* "Image title")' ) end it do expect(camofy('')).to eq( - '' + '' ) end it do expect(camofy("")).to eq( - "" + "" ) end it do expect(camofy('')).to eq( - '' + '' ) end it do expect(camofy('')).to eq( - '' + '' ) end it do expect(camofy('')).to eq( - '' + '' ) end it do expect(camofy('')).to eq( - '' + '' ) end diff --git a/spec/models/mail_alias_spec.rb b/spec/models/mail_alias_spec.rb index cb175468..975a3bca 100644 --- a/spec/models/mail_alias_spec.rb +++ b/spec/models/mail_alias_spec.rb @@ -33,8 +33,7 @@ let(:other_mail_alias) { create(:mail_alias, :with_group) } subject(:mail_alias) do - build_stubbed(:mail_alias, - :with_group, email: other_mail_alias.email) + build(:mail_alias, :with_group, email: other_mail_alias.email) end it { expect(mail_alias).not_to be_valid } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2c7b8758..0251547e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -97,7 +97,7 @@ end context 'when with an invalid emergency_number' do - subject(:user) { build_stubbed(:user, emergency_number: '+3161234567890') } + subject(:user) { build_stubbed(:user, emergency_number: '+31612345678901') } it { expect(user).not_to be_valid } end @@ -194,13 +194,13 @@ let(:user) { create(:user) } context 'username' do - subject(:duplicate_user) { build_stubbed(:user, username: user.username) } + subject(:duplicate_user) { build(:user, username: user.username) } it { expect(duplicate_user).not_to be_valid } end context 'email' do - subject(:duplicate_user) { build_stubbed(:user, email: user.email) } + subject(:duplicate_user) { build(:user, email: user.email) } it { expect(duplicate_user).not_to be_valid } end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index e08aeb32..22fb5929 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -33,7 +33,7 @@ config.include ActionMailbox::TestHelper # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = Rails.root.join('spec', 'fixtures') + config.fixture_paths = 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/requests/v1/users_controller/index_spec.rb b/spec/requests/v1/users_controller/index_spec.rb index bfaee2b7..a432fb70 100644 --- a/spec/requests/v1/users_controller/index_spec.rb +++ b/spec/requests/v1/users_controller/index_spec.rb @@ -33,6 +33,10 @@ user_permission_list: %w[user.read group.read]) end + before { Bullet.enable = false } + + after { Bullet.enable = true } + it do expect( json['data'].first['relationships']['active_groups']['data'].first['id'].to_i diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index adff284d..a2b7cbbd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,6 +7,7 @@ minimum_coverage_by_file 95 end +require 'active_support' require 'pundit/rspec' require 'vcr' diff --git a/spec/support/behaviors/requests/model_with_conditionally_updatable_attributes.rb b/spec/support/behaviors/requests/model_with_conditionally_updatable_attributes.rb index 6c4e98fe..462a01b4 100644 --- a/spec/support/behaviors/requests/model_with_conditionally_updatable_attributes.rb +++ b/spec/support/behaviors/requests/model_with_conditionally_updatable_attributes.rb @@ -1,4 +1,4 @@ -shared_examples 'a model with conditionally updatable attributes' do |unrestricted_attrs, permissible_attrs, response| # rubocop:disable Layout/LineLength +shared_examples 'a model with conditionally updatable attributes' do |unrestricted_attrs, permissible_attrs, response| let(:new_attrs) do attrs = record.attributes.symbolize_keys.transform_values do |value| case value