diff --git a/Gemfile b/Gemfile index 98897536a3..c935b5410f 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' ruby '>= 3.0.0' gem 'puma', '~> 6.3' -gem 'rails', '~> 7.0' +gem 'rails', '~> 7.1.1' gem 'sprockets', '~> 3.7.2' gem 'thor', '~> 1.2' gem 'rack', '~> 2.2.7' diff --git a/Gemfile.lock b/Gemfile.lock index 29cdc8aa4d..33e355a06b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,75 +39,83 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + actioncable (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) 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.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) 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.1) + actionpack (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activesupport (= 7.1.1) 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.1) + actionview (= 7.1.1) + activesupport (= 7.1.1) + nokogiri (>= 1.8.5) + 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.1) + actionpack (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8) - activesupport (= 7.0.8) + actionview (7.1.1) + activesupport (= 7.1.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_serializers (0.10.14) actionpack (>= 4.1) activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.0.8) - activesupport (= 7.0.8) + activejob (7.1.1) + activesupport (= 7.1.1) globalid (>= 0.3.6) - activemodel (7.0.8) - activesupport (= 7.0.8) - activerecord (7.0.8) - activemodel (= 7.0.8) - activesupport (= 7.0.8) - activestorage (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activesupport (= 7.0.8) + activemodel (7.1.1) + activesupport (= 7.1.1) + activerecord (7.1.1) + activemodel (= 7.1.1) + activesupport (= 7.1.1) + timeout (>= 0.4.0) + activestorage (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activesupport (= 7.1.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8) + activesupport (7.1.1) + 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) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) @@ -158,6 +166,7 @@ GEM erubi (~> 1.4) parser (>= 2.4) smart_properties + bigdecimal (3.1.4) bindata (2.4.15) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) @@ -237,6 +246,8 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) + drb (2.1.1) + ruby2_keywords ed25519 (1.3.0) elasticsearch (7.13.3) elasticsearch-api (= 7.13.3) @@ -305,8 +316,8 @@ GEM fuubar (2.5.1) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) haml (6.2.0) temple (>= 0.8.2) thor @@ -357,7 +368,11 @@ GEM rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) idn-ruby (0.1.5) + io-console (0.6.0) ipaddress (0.8.3) + irb (1.8.1) + rdoc + reline (>= 0.3.8) jmespath (1.6.2) json (2.6.3) json-canonicalization (0.3.2) @@ -434,7 +449,6 @@ GEM azure-storage-blob (~> 2.0.1) hashie (~> 5.0) memory_profiler (1.0.1) - method_source (1.0.0) mime-types (3.5.1) mime-types-data (~> 3.2015) mime-types-data (3.2023.0808) @@ -444,11 +458,12 @@ GEM msgpack (1.7.1) multi_json (1.15.0) multipart-post (2.3.0) + mutex_m (0.1.2) net-http (0.3.2) uri net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.3.7) + net-imap (0.4.1) date net-protocol net-ldap (0.18.0) @@ -456,7 +471,7 @@ GEM net-protocol net-protocol (0.2.1) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol nio4r (2.5.9) nokogiri (1.15.4) @@ -512,6 +527,8 @@ GEM net-smtp premailer (~> 1.7, >= 1.7.9) private_address_check (0.5.0) + psych (5.1.1) + stringio public_suffix (5.0.3) puma (6.4.0) nio4r (~> 2.0) @@ -534,22 +551,27 @@ GEM rack rack-proxy (0.7.6) 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.1) + actioncable (= 7.1.1) + actionmailbox (= 7.1.1) + actionmailer (= 7.1.1) + actionpack (= 7.1.1) + actiontext (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activemodel (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) bundler (>= 1.15.0) - railties (= 7.0.8) + railties (= 7.1.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -564,19 +586,22 @@ GEM rails-i18n (7.0.8) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) - method_source + railties (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.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.0.6) rdf (3.2.11) link_header (~> 0.0, >= 0.0.8) rdf-normalize (0.6.1) rdf (~> 3.2) + rdoc (6.5.0) + psych (>= 4.0.0) redcarpet (3.6.0) redis (4.8.1) redis-namespace (1.11.0) @@ -584,13 +609,15 @@ GEM redlock (1.3.2) redis (>= 3.0.0, < 6.0) regexp_parser (2.8.2) + reline (0.3.9) + io-console (~> 0.5) request_store (1.5.1) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.2.6) - rotp (6.2.2) + rotp (6.3.0) rouge (4.1.2) rpam2 (4.0.2) rqrcode (2.2.0) @@ -712,6 +739,7 @@ GEM statsd-ruby (1.5.0) stoplight (3.0.2) redlock (~> 1.0) + stringio (3.0.8) strong_migrations (0.8.0) activerecord (>= 5.2) swd (1.3.0) @@ -783,6 +811,7 @@ GEM rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) + webrick (1.8.1) websocket (1.2.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -878,7 +907,7 @@ DEPENDENCIES rack-attack (~> 6.6) rack-cors (~> 2.0) rack-test (~> 2.1) - rails (~> 7.0) + rails (~> 7.1.1) rails-controller-testing (~> 1.0) rails-i18n (~> 7.0) rails-settings-cached (~> 0.6)! @@ -929,4 +958,4 @@ RUBY VERSION ruby 3.2.2p53 BUNDLED WITH - 2.4.13 + 2.4.20 diff --git a/app/javascript/packs/admin.jsx b/app/javascript/packs/admin.jsx index ebcc6903f8..ac2d1bfa9b 100644 --- a/app/javascript/packs/admin.jsx +++ b/app/javascript/packs/admin.jsx @@ -2,7 +2,7 @@ import './public-path'; import React from 'react'; import { createRoot } from 'react-dom/client'; -import { delegate } from '@rails/ujs'; +import delegate from '@rails/ujs'; import ready from '../mastodon/ready'; diff --git a/app/javascript/packs/public.jsx b/app/javascript/packs/public.jsx index ae4a7410e1..12f37f71f8 100644 --- a/app/javascript/packs/public.jsx +++ b/app/javascript/packs/public.jsx @@ -5,7 +5,7 @@ import './public-path'; import { IntlMessageFormat } from 'intl-messageformat'; import { defineMessages } from 'react-intl'; -import { delegate } from '@rails/ujs'; +import delegate from '@rails/ujs'; import axios from 'axios'; import { throttle } from 'lodash'; diff --git a/app/lib/cache_buster.rb b/app/lib/cache_buster.rb index c54b0da1a1..554f2ba95d 100644 --- a/app/lib/cache_buster.rb +++ b/app/lib/cache_buster.rb @@ -2,7 +2,7 @@ class CacheBuster def initialize(options = {}) - ActiveSupport::Deprecation.warn('Default values for the cache buster secret header name and values will be removed in Mastodon 4.3. Please set them explicitely if you rely on those.') unless options[:http_method] || (options[:secret] && options[:secret_header]) + Rails.application.deprecators[:mastodon].warn('Default values for the cache buster secret header name and values will be removed in Mastodon 4.3. Please set them explicitely if you rely on those.') unless options[:http_method] || (options[:secret] && options[:secret_header]) @secret_header = options[:secret_header] || (options[:http_method] ? nil : 'Secret-Header') diff --git a/app/models/concerns/has_user_settings.rb b/app/models/concerns/has_user_settings.rb index 5d05019f6b..b7c7104a13 100644 --- a/app/models/concerns/has_user_settings.rb +++ b/app/models/concerns/has_user_settings.rb @@ -4,7 +4,7 @@ module HasUserSettings extend ActiveSupport::Concern included do - serialize :settings, UserSettingsSerializer + serialize :settings, coder: UserSettingsSerializer end def settings_attributes=(attributes) diff --git a/app/models/concerns/status_safe_reblog_insert.rb b/app/models/concerns/status_safe_reblog_insert.rb index 5d464697c5..0007b46d40 100644 --- a/app/models/concerns/status_safe_reblog_insert.rb +++ b/app/models/concerns/status_safe_reblog_insert.rb @@ -15,7 +15,7 @@ module StatusSafeReblogInsert # # The code is kept similar to ActiveRecord::Persistence code and calls it # directly when we are not handling a reblog. - def _insert_record(values) + def _insert_record(values, returning) return super unless values.is_a?(Hash) && values['reblog_of_id']&.value.present? primary_key = self.primary_key @@ -34,7 +34,7 @@ module StatusSafeReblogInsert # Instead, we use a custom builder when a reblog is happening: im = _compile_reblog_insert(values) - connection.insert(im, "#{self} Create", primary_key || false, primary_key_value).tap do |result| + connection.insert(im, "#{self} Create", primary_key || false, primary_key_value, returning: returning).tap do |result| # Since we are using SELECT instead of VALUES, a non-error `nil` return is possible. # For our purposes, it's equivalent to a foreign key constraint violation raise ActiveRecord::InvalidForeignKey, "(reblog_of_id)=(#{values['reblog_of_id'].value}) is not present in table \"statuses\"" if result.nil? diff --git a/config/application.rb b/config/application.rb index d98e332339..0fd053f83f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -196,7 +196,7 @@ module Mastodon config.active_job.queue_adapter = :sidekiq config.action_mailer.deliver_later_queue_name = 'mailers' - config.action_mailer.preview_path = Rails.root.join('spec', 'mailers', 'previews') + config.action_mailer.preview_paths << Rails.root.join('spec', 'mailers', 'previews') # We use our own middleware for this config.public_file_server.enabled = false @@ -205,6 +205,10 @@ module Mastodon config.middleware.use Rack::Attack config.middleware.use Mastodon::RackMiddleware + initializer :deprecator do |app| + app.deprecators[:mastodon] = ActiveSupport::Deprecation.new('4.3', 'mastodon/mastodon') + end + config.to_prepare do Doorkeeper::AuthorizationsController.layout 'modal' Doorkeeper::AuthorizedApplicationsController.layout 'admin' diff --git a/lib/active_record/batches.rb b/lib/active_record/batches.rb index 91e50cc43d..7960b6e10d 100644 --- a/lib/active_record/batches.rb +++ b/lib/active_record/batches.rb @@ -13,7 +13,7 @@ module ActiveRecord column_names.unshift(primary_key) - relation = relation.reorder(batch_order(order)).limit(batch_limit) + relation = relation.reorder(build_batch_orders(order).to_h).limit(batch_limit) relation.skip_query_cache! batch_relation = relation diff --git a/package.json b/package.json index 16dcd2f549..1057e737ff 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@gamestdio/websocket": "^0.3.2", "@github/webauthn-json": "^2.1.1", "@material-design-icons/svg": "^0.14.10", - "@rails/ujs": "^7.0.6", + "@rails/ujs": "^7.1.1", "@reduxjs/toolkit": "^1.9.5", "@renchap/compression-webpack-plugin": "^6.1.4", "@svgr/webpack": "^5.5.0", diff --git a/spec/generators/post_deployment_migration_generator_spec.rb b/spec/generators/post_deployment_migration_generator_spec.rb index d552880e3b..d770a78e97 100644 --- a/spec/generators/post_deployment_migration_generator_spec.rb +++ b/spec/generators/post_deployment_migration_generator_spec.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'rails_helper' -require 'rails/generators/testing/behaviour' +require 'rails/generators/testing/behavior' require 'rails/generators/testing/assertions' require 'generators/post_deployment_migration/post_deployment_migration_generator' describe PostDeploymentMigrationGenerator, type: :generator do - include Rails::Generators::Testing::Behaviour + include Rails::Generators::Testing::Behavior include Rails::Generators::Testing::Assertions include FileUtils diff --git a/spec/lib/cache_buster_spec.rb b/spec/lib/cache_buster_spec.rb index 3dc62a8154..78ca183490 100644 --- a/spec/lib/cache_buster_spec.rb +++ b/spec/lib/cache_buster_spec.rb @@ -31,7 +31,7 @@ describe CacheBuster do around do |example| # Disables the CacheBuster.new deprecation warning about default arguments. # Remove this `silence` block when default arg support is removed from CacheBuster - ActiveSupport::Deprecation.silence do + Rails.application.deprecators[:mastodon].silence do example.run end end diff --git a/yarn.lock b/yarn.lock index f67c3fde4a..a179bd7525 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1839,10 +1839,10 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== -"@rails/ujs@^7.0.6": - version "7.0.8" - resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-7.0.8.tgz#59853367d0827b3955d2c4bedfd5eba4a79d3422" - integrity sha512-tOQQBVH8LsUpGXqDnk+kaOGVsgZ8maHAhEiw3Git3p88q+c0Slgu47HuDnL6sVxeCfz24zbq7dOjsVYDiTpDIA== +"@rails/ujs@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-7.1.1.tgz#f8df96e406a2a824084b637880e57c257073cb05" + integrity sha512-ywGwWNiqXN3Bb1BifVQTrkWEWcAGLHW3D0JNQMQeu57LsoluRzvnenNLPsmdoDPkrmSIASDXNsJiCIpUzFj8CA== "@reduxjs/toolkit@^1.9.5": version "1.9.7"