diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0cb9289d..8a9dc2517 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: services: postgres: - image: postgres:13.12 + image: postgres:15 env: POSTGRES_HOST: localhost POSTGRES_USER: postgres diff --git a/.solargraph.yml b/.solargraph.yml index 2bac560c8..55a5253b9 100644 --- a/.solargraph.yml +++ b/.solargraph.yml @@ -9,6 +9,7 @@ exclude: require: [] domains: [] plugins: +- solargraph-rails - solargraph-standardrb reporters: - require_not_found diff --git a/Gemfile b/Gemfile index d8603e6b9..b2b068942 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.1.4" # Bundle edge Rails instead: gem "rails", github: "rails/rails" -gem "rails", "~> 7.0.0" +gem "rails", "~> 7.1.0" # Since Rails 7 sprockets is optional; we still use it so we need to depend on # the gem explicitly @@ -31,7 +31,7 @@ gem "jbuilder", "~> 2.11" gem "acts_as_tenant" gem "devise" gem "pundit" -gem "audited", github: "simmerz/audited" +gem "audited" gem "turbolinks_render" gem "money-rails" gem "mjml-rails" # , github: "jim/mjml-rails", branch: "webpacker" @@ -78,6 +78,7 @@ group :development do gem "web-console", ">= 3.3.0" gem "listen" gem "solargraph" + gem "solargraph-rails" gem "solargraph-standardrb" gem "lefthook" gem "erb_lint", "~> 0.1.1" diff --git a/Gemfile.lock b/Gemfile.lock index ee31817cb..89781e357 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,80 +1,82 @@ -GIT - remote: https://github.com/simmerz/audited.git - revision: 3cf0141cc28cdad572e2e719b75d355515967dd9 - specs: - audited (5.0.2) - activerecord (>= 5.0, < 7.1) - GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + actioncable (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + zeitwerk (~> 2.6) + actionmailbox (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) mail (>= 2.7.1) 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) + actionmailer (7.1.2) + actionpack (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activesupport (= 7.1.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8) - actionview (= 7.0.8) - activesupport (= 7.0.8) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.2) + actionview (= 7.1.2) + activesupport (= 7.1.2) + 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) - actionpack (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.2) + actionpack (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8) - activesupport (= 7.0.8) + actionview (7.1.2) + activesupport (= 7.1.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8) - activesupport (= 7.0.8) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.2) + activesupport (= 7.1.2) globalid (>= 0.3.6) - activemodel (7.0.8) - activesupport (= 7.0.8) - activerecord (7.0.8) - activemodel (= 7.0.8) - activesupport (= 7.0.8) + activemodel (7.1.2) + activesupport (= 7.1.2) + activerecord (7.1.2) + activemodel (= 7.1.2) + activesupport (= 7.1.2) + timeout (>= 0.4.0) activerecord-postgres_enum (2.0.1) activerecord (>= 5.2) pg - activestorage (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activesupport (= 7.0.8) + activestorage (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activesupport (= 7.1.2) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) acts_as_list (1.1.0) activerecord (>= 4.2) @@ -86,6 +88,9 @@ GEM appsignal (3.4.12) rack ast (2.4.2) + audited (5.4.2) + activerecord (>= 5.0, < 7.2) + request_store (~> 1.2) aws-eventstream (1.2.0) aws-partitions (1.576.0) aws-sdk-core (3.130.1) @@ -106,7 +111,8 @@ GEM barnes (0.0.9) multi_json (~> 1) statsd-ruby (~> 1.1) - bcrypt (3.1.16) + base64 (0.2.0) + bcrypt (3.1.19) benchmark (0.2.0) better_html (1.0.16) actionview (>= 4.0) @@ -116,6 +122,7 @@ GEM html_tokenizer (~> 0.0.6) parser (>= 2.4) smart_properties + bigdecimal (3.1.4) bindex (0.8.1) bootsnap (1.11.1) msgpack (~> 1.2) @@ -133,11 +140,12 @@ GEM certifi (2018.01.18) chronic (0.10.2) concurrent-ruby (1.2.2) + connection_pool (2.4.1) crass (1.0.6) cssbundling-rails (1.3.2) railties (>= 6.0.0) date (3.3.4) - devise (4.8.1) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -150,6 +158,8 @@ GEM dotenv-rails (2.7.6) dotenv (= 2.7.6) railties (>= 3.2) + drb (2.2.0) + ruby2_keywords e2mmap (0.1.0) erb_lint (0.1.1) activesupport @@ -218,6 +228,10 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + io-console (0.6.0) + irb (1.9.0) + rdoc + reline (>= 0.3.8) jaro_winkler (1.5.4) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -251,7 +265,7 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.21.3) + loofah (2.21.4) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -261,10 +275,9 @@ GEM net-smtp marcel (1.0.2) matrix (0.4.2) - method_source (1.0.0) mini_magick (4.11.0) mini_mime (1.1.2) - mini_portile2 (2.8.4) + mini_portile2 (2.8.5) minitest (5.15.0) minitest-ci (3.4.0) minitest (>= 5.0.6) @@ -282,6 +295,7 @@ GEM multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) + mutex_m (0.2.0) net-imap (0.4.4) date net-protocol @@ -329,31 +343,38 @@ GEM prime (0.1.2) forwardable singleton + psych (5.1.1.1) + stringio public_suffix (5.0.3) puma (6.4.0) nio4r (~> 2.0) pundit (2.1.1) activesupport (>= 3.0.0) - racc (1.7.1) + racc (1.7.3) rack (2.2.8) rack-protection (2.2.0) rack + rack-session (1.0.1) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - 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) + rackup (1.0.0) + rack (< 3) + webrick + rails (7.1.2) + actioncable (= 7.1.2) + actionmailbox (= 7.1.2) + actionmailer (= 7.1.2) + actionpack (= 7.1.2) + actiontext (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activemodel (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) bundler (>= 1.15.0) - railties (= 7.0.8) + railties (= 7.1.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -365,24 +386,29 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) - method_source + railties (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) + 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.0.6) + rake (13.1.0) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) + rdoc (6.6.0) + psych (>= 4.0.0) regexp_parser (2.8.1) + reline (0.4.0) + io-console (~> 0.5) request_store (1.5.0) rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.1) + actionpack (>= 5.2) + railties (>= 5.2) reverse_markdown (2.1.1) nokogiri rexml (3.2.6) @@ -429,6 +455,9 @@ GEM thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) + solargraph-rails (1.1.0) + activesupport + solargraph solargraph-standardrb (0.0.4) solargraph (>= 0.39.1) standard (>= 0.4.1) @@ -452,10 +481,11 @@ GEM statsd-ruby (1.5.0) store_model (0.13.0) activerecord (>= 5.2) + stringio (3.0.9) sucker_punch (3.0.1) concurrent-ruby (~> 1.0) text (1.3.1) - thor (1.2.2) + thor (1.3.0) tilt (2.0.10) timeout (0.4.1) translation (1.29) @@ -490,7 +520,7 @@ GEM nokogiri (~> 1.8) yard (0.9.27) webrick (~> 1.7.0) - zeitwerk (2.6.11) + zeitwerk (2.6.12) PLATFORMS ruby @@ -500,7 +530,7 @@ DEPENDENCIES acts_as_list acts_as_tenant appsignal - audited! + audited aws-sdk-s3 barnes bootsnap (>= 1.4.1) @@ -532,12 +562,13 @@ DEPENDENCIES pg_search puma pundit - rails (~> 7.0.0) + rails (~> 7.1.0) rails-controller-testing reverse_markdown scenic selenium-webdriver solargraph + solargraph-rails solargraph-standardrb sprockets-rails spy diff --git a/app/controllers/admin/borrow_policies_controller.rb b/app/controllers/admin/borrow_policies_controller.rb index 9242ee77d..065d6e608 100644 --- a/app/controllers/admin/borrow_policies_controller.rb +++ b/app/controllers/admin/borrow_policies_controller.rb @@ -1,6 +1,6 @@ module Admin class BorrowPoliciesController < BaseController - before_action :set_borrow_policy, only: [:edit, :update, :destroy] + before_action :set_borrow_policy, only: [:edit, :update] def index @borrow_policies = BorrowPolicy.alpha_by_code diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index 0ef99f290..0da72d98f 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -2,7 +2,7 @@ module Admin class CategoriesController < BaseController include ActionView::RecordIdentifier - before_action :set_category, only: [:show, :edit, :update, :destroy] + before_action :set_category, only: [:edit, :update, :destroy] def index @categories = CategoryNode.all.sorted diff --git a/app/models/item.rb b/app/models/item.rb index 1f47348fe..e6d4fbc2c 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -220,7 +220,7 @@ def audited_attributes end # called when item is updated - def audited_changes + def audited_changes(**args) unless @current_category_ids.present? cache_category_ids(nil) end diff --git a/bin/rails b/bin/rails index 5badb2fde..efc037749 100755 --- a/bin/rails +++ b/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -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 d87d5f578..4fbf10b96 100755 --- a/bin/rake +++ b/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index 65b95577b..dcfbce48f 100755 --- a/bin/setup +++ b/bin/setup @@ -1,38 +1,36 @@ #!/usr/bin/env ruby -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 ==") + system(*args, exception: true) end FileUtils.chdir APP_ROOT do - # This script is a starting point to setup your application. + # 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') - - # Install JavaScript dependencies - system! 'bin/yarn' + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # 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:setup' + system! "bin/rails db:prepare" puts "\n== Loading dev data ==" - system! 'bin/rails devdata:load' + system! "bin/rails devdata:load" 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 1b26ff51c..04da0e6da 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,17 +1,18 @@ require_relative "boot" require "rails" +require "active_model/railtie" +require "active_job/railtie" require "active_record/railtie" require "active_storage/engine" require "action_controller/railtie" -require "action_view/railtie" require "action_mailer/railtie" -require "active_job/railtie" -require "sprockets/railtie" -# require 'action_cable/engine' -# require 'action_mailbox/engine' +# require "action_mailbox/engine" require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" require "rails/test_unit/railtie" +require "sprockets/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -20,8 +21,18 @@ module Circulate class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults 7.1 + # 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.active_record.has_many_inversing = false config.active_storage.track_variants = false config.active_storage.queues.analysis = :active_storage_analysis @@ -33,11 +44,6 @@ class Application < Rails::Application config.action_view.form_with_generates_remote_forms = true ActiveSupport.utc_to_local_returns_utc_offset_times = false - # 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. - # Delegates exception handling to the routes config.exceptions_app = routes end diff --git a/config/environments/development.rb b/config/environments/development.rb index 795ca5db8..75b532e94 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,11 @@ +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,9 +13,12 @@ # 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 @@ -41,22 +45,26 @@ # 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 + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true # Suppress logger output for asset requests. - # config.assets.quiet = true + config.assets.quiet = true # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. @@ -81,4 +89,7 @@ config.action_mailer.asset_host = "http://localhost:3000" config.action_mailer.delivery_method = :letter_opener config.action_mailer.perform_deliveries = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index 769b5541d..217a107ab 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,8 +1,10 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # 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 @@ -26,10 +28,10 @@ # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. - # config.assets.compile = false + config.assets.compile = false # 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" config.action_mailer.default_url_options = {host: "app.chicagotoollibrary.org"} config.action_mailer.asset_host = "https://app.chicagotoollibrary.org" @@ -49,18 +51,21 @@ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - config.force_ssl = false - - config.log_level = :info + config.force_ssl = true # Prepend all log lines with the following tags. config.log_tags = [:request_id] + # Info include 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 = "circulate_production" config.action_mailer.perform_caching = false diff --git a/config/environments/test.rb b/config/environments/test.rb index a3ec4d561..ea5b86c60 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,18 +1,22 @@ +require "active_support/core_ext/integer/time" require_dependency "acts_as_tenant/test_tenant_middleware" +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # 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. - config.eager_load = false + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true @@ -25,8 +29,8 @@ config.action_controller.perform_caching = false config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -45,8 +49,30 @@ # 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 + + # 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 = true config.middleware.use ActsAsTenant::TestTenantMiddleware + + # After the Rails 7.1 upgrade, in CI we saw deadlocks that seemed to stem + # from ActiveJob threads executing outside of the test transaction. These + # hangs were reproducible locally by setting PARALLEL_WORKERS=1. + # + # Setting the queue_adapter explicitly to :test seems to work around the + # issue. + # + # See: https://github.com/rails/rails/issues/48468 + config.active_job.queue_adapter = :test end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 000000000..2eeef966f --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,12 @@ +# 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" + +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 1b79e310e..b3076b38f 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,27 +1,25 @@ # 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, inline scripts, and inline styles. +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src style-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) } - -# 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/devise.rb b/config/initializers/devise.rb index 9a110086e..6cc107dc2 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -8,7 +8,10 @@ # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. - # config.secret_key = '89a27c1409f3802ed5f4ffa457f5280a8811d5bf792342cde84155615235c75313bf2e6e4197589b470965cd922402d3311a65c305ee99fc502dd030cb1687a4' + # + # Setting this explicitly to work around deprecation warning in Rails 7.1. + # See: https://github.com/heartcombo/devise/issues/5644 + config.secret_key = Rails.application.secret_key_base # ==> Controller configuration # Configure the parent class to the devise controllers. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 8a26947ca..b8edda0f5 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,7 +1,10 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. +# 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 += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :password, :email, :phone_number, :name, :pronouns, :address1, :address2, :postal_code ] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 48d7b512d..ef6fd0a9c 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,12 +4,17 @@ # 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" +# end + ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym "UI" inflect.acronym "HTML" diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..7db3b9577 --- /dev/null +++ b/config/initializers/permissions_policy.rb @@ -0,0 +1,13 @@ +# Be sure to restart your server when you modify this file. + +# 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 |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" +# end diff --git a/db/migrate/20231112014456_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20231112014456_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 000000000..93c8b85ad --- /dev/null +++ b/db/migrate/20231112014456_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 a35f8b344..27bf0587c 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.define(version: 2023_10_28_225001) do +ActiveRecord::Schema[7.1].define(version: 2023_11_12_014456) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -86,8 +86,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 @@ -107,7 +107,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", null: false t.string "service_name", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true @@ -125,8 +125,8 @@ t.integer "amount_cents", default: 0, null: false t.string "amount_currency", default: "USD", null: false t.bigint "member_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.enum "payment_source", enum_type: "adjustment_source" t.string "square_transaction_id" t.enum "kind", null: false, enum_type: "adjustment_kind" @@ -136,16 +136,16 @@ create_table "agreement_acceptances", force: :cascade do |t| t.bigint "member_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 ["member_id"], name: "index_agreement_acceptances_on_member_id" end create_table "appointment_holds", force: :cascade do |t| t.bigint "appointment_id" t.bigint "hold_id" - 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 ["appointment_id"], name: "index_appointment_holds_on_appointment_id" t.index ["hold_id"], name: "index_appointment_holds_on_hold_id" end @@ -153,8 +153,8 @@ create_table "appointment_loans", force: :cascade do |t| t.bigint "appointment_id" t.bigint "loan_id" - 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 ["appointment_id"], name: "index_appointment_loans_on_appointment_id" t.index ["loan_id"], name: "index_appointment_loans_on_loan_id" end @@ -164,8 +164,8 @@ t.datetime "ends_at", null: false t.text "comment", default: "", null: false t.bigint "member_id" - 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.datetime "completed_at" t.index ["member_id"], name: "index_appointments_on_member_id" end @@ -198,8 +198,8 @@ t.integer "fine_cents", default: 0, null: false t.string "fine_currency", default: "USD", null: false t.integer "fine_period", default: 1, 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.boolean "uniquely_numbered", default: true, null: false t.string "code", null: false t.string "description" @@ -214,8 +214,8 @@ create_table "categories", force: :cascade do |t| t.string "name", null: false t.string "slug", 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.integer "categorizations_count", default: 0, null: false t.bigint "parent_id" t.integer "library_id" @@ -227,8 +227,8 @@ create_table "categorizations", force: :cascade do |t| t.bigint "item_id", null: false t.bigint "category_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 ["category_id"], name: "index_categorizations_on_category_id" t.index ["item_id", "category_id"], name: "index_categorizations_on_item_id_and_category_id" t.index ["item_id"], name: "index_categorizations_on_item_id" @@ -237,8 +237,8 @@ create_table "documents", force: :cascade do |t| t.string "name", null: false t.string "summary" - 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.string "code" t.integer "library_id" t.index ["library_id", "code"], name: "index_documents_on_library_id_and_code" @@ -251,8 +251,8 @@ t.datetime "finish", null: false t.string "summary" t.string "description" - 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.integer "library_id" t.jsonb "attendees" t.index ["calendar_id", "calendar_event_id"], name: "index_events_on_calendar_id_and_calendar_event_id", unique: true @@ -265,8 +265,8 @@ t.integer "amount_cents", null: false t.string "code", null: false t.bigint "membership_id" - 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.string "recipient_name" t.integer "library_id" t.index ["library_id", "code"], name: "index_gift_memberships_on_library_id_and_code", unique: true @@ -277,8 +277,8 @@ t.bigint "member_id", null: false t.bigint "item_id", null: false t.bigint "creator_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.datetime "ended_at" t.bigint "loan_id" t.integer "library_id" @@ -299,8 +299,8 @@ t.enum "kind", enum_type: "item_attachment_kind" t.string "other_kind" t.string "notes" - 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 ["creator_id"], name: "index_item_attachments_on_creator_id" t.index ["item_id"], name: "index_item_attachments_on_item_id" end @@ -312,8 +312,8 @@ t.string "brand" t.string "model" t.string "serial" - 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.integer "number", null: false t.enum "status", default: "active", null: false, enum_type: "item_status" t.bigint "borrow_policy_id", null: false @@ -344,8 +344,8 @@ t.string "city", null: false t.string "email", null: false t.text "address" - 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.boolean "allow_members", default: true, null: false t.boolean "allow_payments", default: true, null: false t.boolean "allow_volunteers", default: true, null: false @@ -357,8 +357,8 @@ t.string "title" t.boolean "published" t.bigint "library_id" - 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 ["library_id", "published"], name: "index_library_updates_on_library_id_and_published" t.index ["library_id"], name: "index_library_updates_on_library_id" end @@ -368,8 +368,8 @@ t.bigint "member_id" t.datetime "due_at" t.datetime "ended_at" - 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.boolean "uniquely_numbered", null: false t.integer "renewal_count", default: 0, null: false t.bigint "initial_loan_id" @@ -398,8 +398,8 @@ t.integer "id_kind" t.string "other_id_kind" t.boolean "address_verified" - 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.integer "status", default: 0, null: false t.string "postal_code" t.boolean "reminders_via_email", default: false, null: false @@ -422,10 +422,10 @@ create_table "memberships", force: :cascade do |t| t.bigint "member_id", null: false - t.datetime "started_at", precision: 6 - t.datetime "ended_at", precision: 6 - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "started_at" + t.datetime "ended_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.integer "library_id" t.index ["member_id"], name: "index_memberships_on_member_id" end @@ -434,8 +434,8 @@ t.string "notable_type", null: false t.bigint "notable_id", null: false t.bigint "creator_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 ["creator_id"], name: "index_notes_on_creator_id" t.index ["notable_type", "notable_id"], name: "index_notes_on_notable_type_and_notable_id" end @@ -447,8 +447,8 @@ t.uuid "uuid", null: false t.enum "status", default: "pending", null: false, enum_type: "notification_status" t.string "subject", 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.integer "library_id" t.index ["library_id"], name: "index_notifications_on_library_id" t.index ["member_id"], name: "index_notifications_on_member_id" @@ -458,8 +458,8 @@ create_table "renewal_requests", force: :cascade do |t| t.enum "status", default: "requested", null: false, enum_type: "renewal_request_status" t.bigint "loan_id" - 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.integer "library_id" t.index ["library_id"], name: "index_renewal_requests_on_library_id" t.index ["loan_id"], name: "index_renewal_requests_on_loan_id" @@ -469,8 +469,8 @@ t.string "url", null: false t.string "slug", null: false t.integer "views_count", default: 0, 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.integer "library_id" t.index ["library_id", "slug"], name: "index_short_links_on_library_id_and_slug" end @@ -480,8 +480,8 @@ t.bigint "ticket_id", null: false t.bigint "creator_id", null: false t.bigint "audit_id" - 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.bigint "library_id" t.index ["audit_id"], name: "index_ticket_updates_on_audit_id" t.index ["creator_id"], name: "index_ticket_updates_on_creator_id" @@ -494,8 +494,8 @@ t.bigint "item_id", null: false t.enum "status", default: "assess", null: false, enum_type: "ticket_status" t.bigint "creator_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.bigint "library_id" t.index ["creator_id"], name: "index_tickets_on_creator_id" t.index ["item_id"], name: "index_tickets_on_item_id" @@ -516,8 +516,8 @@ t.integer "failed_attempts", default: 0, null: false t.string "unlock_token" t.datetime "locked_at" - 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.enum "role", default: "member", null: false, enum_type: "user_role" t.bigint "member_id" t.integer "library_id" diff --git a/docker-compose.yml b/docker-compose.yml index f103f31b5..2513c9a8c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: - example.com database: - image: postgres:13.12 + image: postgres:15 env_file: - config/docker.env volumes: diff --git a/flake.nix b/flake.nix index a7d4b4e28..9d4a3965a 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,9 @@ # for deployment heroku + + # needed to build psych gem, which is in the dependency tree as of rails 7.1 + libyaml ]; # Keep gems installed in a subdirectory diff --git a/lib/rails_solargraph.rb b/lib/rails_solargraph.rb deleted file mode 100644 index c66cd05f1..000000000 --- a/lib/rails_solargraph.rb +++ /dev/null @@ -1,32 +0,0 @@ -# https://gist.github.com/castwide/28b349566a223dfb439a337aea29713e -# -# The following comments fill some of the gaps in Solargraph's understanding of -# Rails apps. Since they're all in YARD, they get mapped in Solargraph but -# ignored at runtime. -# -# You can put this file anywhere in the project, as long as it gets included in -# the workspace maps. It's recommended that you keep it in a standalone file -# instead of pasting it into an existing one. -# -# @!parse -# class ActionController::Base -# include ActionController::MimeResponds -# extend ActiveSupport::Callbacks::ClassMethods -# extend AbstractController::Callbacks::ClassMethods -# end -# class ActiveRecord::Base -# extend ActiveRecord::QueryMethods -# extend ActiveRecord::FinderMethods -# extend ActiveRecord::Associations::ClassMethods -# include ActiveRecord::Persistence -# end -# @!override ActiveRecord::FinderMethods#find -# @overload find(id) -# @param id [Integer] -# @return [self] -# @overload find(list) -# @param list [Array] -# @return [Array] -# @overload find(*args) -# @return [Array] -# @return [self, Array] diff --git a/lib/tasks/devdata.rake b/lib/tasks/devdata.rake index f11b2ce6a..d052f2e7b 100644 --- a/lib/tasks/devdata.rake +++ b/lib/tasks/devdata.rake @@ -49,7 +49,7 @@ namespace :devdata do offset = (index + 1) * 10000 admin = library.users.where(role: "admin").first ActsAsTenant.with_tenant(library) do - Audited.audit_model.as_user(admin) do + Audited.audit_class.as_user(admin) do load_models Document, id_offset: offset load_models BorrowPolicy, id_offset: offset load_models Category, id_offset: offset diff --git a/package.json b/package.json index 5b80ceb58..64e44eae5 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "circulate", "private": true, "dependencies": { - "@rails/actioncable": "^6.1.4", - "@rails/actiontext": "^6.1.5", - "@rails/activestorage": "^6.1.3", - "@rails/ujs": "^6.1.4", + "@rails/actioncable": "^7.1.2", + "@rails/actiontext": "^7.1.2", + "@rails/activestorage": "^7.1.2", + "@rails/ujs": "^7.1.2", "awesomplete": "^1.1.4", "esbuild": "^0.19.3", "feather-icons": "^4.25.0", @@ -22,11 +22,13 @@ }, "version": "0.1.0", "devDependencies": { - "markdown-toc": "^1.2.0" + "markdown-toc": "^1.2.0", + "sass-migrator": "^1.7.3" }, "scripts": { "build": "esbuild app/javascript/*.* --minify --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --target=chrome58,firefox57,safari11", "build-dev": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --target=chrome58,firefox57,safari11", - "build:css": "sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules" + "build:css": "sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules", + "postinstall": "sass-migrator -d division node_modules/spectre.css/**/*.scss" } } diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 3ac0d3177..04948d1d8 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -129,7 +129,7 @@ def sign_in_as_admin end def audited_as_admin(&block) - Audited.audit_model.as_user(@user) do + Audited.audit_class.as_user(@user) do yield end end diff --git a/test/controllers/items_controller_test.rb b/test/controllers/items_controller_test.rb index a780b113a..705bdaa01 100644 --- a/test/controllers/items_controller_test.rb +++ b/test/controllers/items_controller_test.rb @@ -44,9 +44,8 @@ class ItemsControllerTest < ActionDispatch::IntegrationTest test "doesn't display the show page for a #{status} item" do hidden_item = create(:item, status: status) - assert_raises ActiveRecord::RecordNotFound do - get item_url(hidden_item) - end + get item_url(hidden_item) + assert_response :not_found end test "hides #{status} items from the item index" do diff --git a/yarn.lock b/yarn.lock index f14688aa9..7cd704b48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -119,29 +119,29 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.3.tgz#e5036be529f757e58d9a7771f2f1b14782986a74" integrity sha512-FbUN+0ZRXsypPyWE2IwIkVjDkDnJoMJARWOcFZn4KPPli+QnKqF0z1anvfaYe3ev5HFCpRDLLBDHyOALLppWHw== -"@rails/actioncable@^6.1.4": - version "6.1.4" - resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.1.4.tgz#c3c5a9f8302c429af9722b6c50ab48049016d2a3" - integrity sha512-0LmSKJTuo2dL6BQ+9xxLnS9lbkyfz2mBGeBnQ2J7o9Bn0l0q+ZC6VuoZMZZXPvABI4QT7Nfknv5WhfKYL+boew== +"@rails/actioncable@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.1.2.tgz#d261ff4b72844f5af496671346ec478798f4ac2c" + integrity sha512-KGziTZfbmGm8/fHOpj515xupbYU+49hsp4etfdpoDJ/CEY2bRZR0cyFcJkpK6n0t/sxOHNWY6bo9vSgXZvT7Mg== -"@rails/actiontext@^6.1.5": - version "6.1.5" - resolved "https://registry.yarnpkg.com/@rails/actiontext/-/actiontext-6.1.5.tgz#29006cff520b72c6845f474540a9ea142eae6380" - integrity sha512-V88uyueaL4VeU0u0P3GiuM0vSBYW3pluYyI7jMmZKWfGZKCspmRLDaJE+30Bx4h3ZQJcRrOCFoTU8hK0cFmCsw== +"@rails/actiontext@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@rails/actiontext/-/actiontext-7.1.2.tgz#2f7772b33951f76a07e9ff83d54519c362d99fd5" + integrity sha512-qiSUtop7rIb9BlwvgU98u+y8erlWhOiV0AveoHQ4EzN11VAWj3Euao9O+Q1iEJfIPcgXRvnsVLIJPrz3ldizFg== dependencies: - "@rails/activestorage" "^6.0.0" + "@rails/activestorage" ">= 7.1.0-alpha" -"@rails/activestorage@^6.0.0", "@rails/activestorage@^6.1.3": - version "6.1.4" - resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-6.1.4.tgz#7772f539cc846df5f4364fc57ccb48860f9e966e" - integrity sha512-1Tm8uaVBhLTDEG4YaFPvqguhjbUGSPVItm0CfkRpIFZIkybWzFAxatIrk4YVOOxB8ZdXS7GdeYa1qVwjdiDkgQ== +"@rails/activestorage@>= 7.1.0-alpha", "@rails/activestorage@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-7.1.2.tgz#088dce680fa1e0a4f8e0c5ac91073f729204ed06" + integrity sha512-evC/xGlpq5XGpcNJina3oNVVB8pUp1GpnN3a84SVA+UNuB6O91OdNRl9BGHNAOo6/jxmFtLb73PIjWqQyVE14w== dependencies: - spark-md5 "^3.0.0" + spark-md5 "^3.0.1" -"@rails/ujs@^6.1.4": - version "6.1.4" - resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-6.1.4.tgz#093d5341595a02089ed309dec40f3c37da7b1b10" - integrity sha512-O3lEzL5DYbxppMdsFSw36e4BHIlfz/xusynwXGv3l2lhSlvah41qviRpsoAlKXxl37nZAqK+UUF5cnGGK45Mfw== +"@rails/ujs@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-7.1.2.tgz#ea903bcc0224e17156015d995b6f1b83e27d64b2" + integrity sha512-c5x02djEKEVVE4qfN4XgElJS4biM0xxtIVpcJ0ZHLK116U19rowTtmD0AJ/RCb3Xaewa4GPIWLlwgeC0dCQqzw== "@stimulus/core@^1.1.1": version "1.1.1" @@ -1630,6 +1630,11 @@ safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== +sass-migrator@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/sass-migrator/-/sass-migrator-1.7.3.tgz#0ac232b530d78a1b84dfaf24aaccdfd03159acf6" + integrity sha512-8JMZ15HMvjE8X3i1NhPu2GQzEIT74xrGACq6J9RzdbJ49N1Fl0lFvfX03+hAQN0MKNYKASq6fx1VZLa5NuwBWw== + sass@^1.67.0: version "1.67.0" resolved "https://registry.yarnpkg.com/sass/-/sass-1.67.0.tgz#fed84d74b9cd708db603b1380d6dc1f71bb24f6f" @@ -1709,10 +1714,10 @@ source-map@^0.6.1, source-map@~0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -spark-md5@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.1.tgz#83a0e255734f2ab4e5c466e5a2cfc9ba2aa2124d" - integrity sha512-0tF3AGSD1ppQeuffsLDIOWlKUd3lS92tFxcsrh5Pe3ZphhnoK+oXIBTzOAThZCiuINZLvpiLH/1VS1/ANEJVig== +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== spectre.css@^0.5.8: version "0.5.9"