Update rails to version 8.1.2 (#36505)

This commit is contained in:
Matt Jankowski
2026-02-27 02:50:35 -05:00
committed by GitHub
parent 7970eb392a
commit 1dbb258d53
8 changed files with 90 additions and 69 deletions

View File

@@ -5,7 +5,7 @@ ruby '>= 3.2.0', '< 3.5.0'
gem 'propshaft' gem 'propshaft'
gem 'puma', '~> 7.0' gem 'puma', '~> 7.0'
gem 'rails', '~> 8.0' gem 'rails', '~> 8.1.0'
gem 'thor', '~> 1.2' gem 'thor', '~> 1.2'
gem 'dotenv' gem 'dotenv'

View File

@@ -10,29 +10,31 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (8.0.3) action_text-trix (2.1.16)
actionpack (= 8.0.3) railties
activesupport (= 8.0.3) actioncable (8.1.2)
actionpack (= 8.1.2)
activesupport (= 8.1.2)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
actionmailbox (8.0.3) actionmailbox (8.1.2)
actionpack (= 8.0.3) actionpack (= 8.1.2)
activejob (= 8.0.3) activejob (= 8.1.2)
activerecord (= 8.0.3) activerecord (= 8.1.2)
activestorage (= 8.0.3) activestorage (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
mail (>= 2.8.0) mail (>= 2.8.0)
actionmailer (8.0.3) actionmailer (8.1.2)
actionpack (= 8.0.3) actionpack (= 8.1.2)
actionview (= 8.0.3) actionview (= 8.1.2)
activejob (= 8.0.3) activejob (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
mail (>= 2.8.0) mail (>= 2.8.0)
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
actionpack (8.0.3) actionpack (8.1.2)
actionview (= 8.0.3) actionview (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
rack (>= 2.2.4) rack (>= 2.2.4)
rack-session (>= 1.0.1) rack-session (>= 1.0.1)
@@ -40,15 +42,16 @@ GEM
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6) rails-html-sanitizer (~> 1.6)
useragent (~> 0.16) useragent (~> 0.16)
actiontext (8.0.3) actiontext (8.1.2)
actionpack (= 8.0.3) action_text-trix (~> 2.1.15)
activerecord (= 8.0.3) actionpack (= 8.1.2)
activestorage (= 8.0.3) activerecord (= 8.1.2)
activesupport (= 8.0.3) activestorage (= 8.1.2)
activesupport (= 8.1.2)
globalid (>= 0.6.0) globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (8.0.3) actionview (8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.11) erubi (~> 1.11)
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
@@ -58,29 +61,29 @@ GEM
activemodel (>= 4.1) activemodel (>= 4.1)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (8.0.3) activejob (8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (8.0.3) activemodel (8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
activerecord (8.0.3) activerecord (8.1.2)
activemodel (= 8.0.3) activemodel (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
timeout (>= 0.4.0) timeout (>= 0.4.0)
activestorage (8.0.3) activestorage (8.1.2)
actionpack (= 8.0.3) actionpack (= 8.1.2)
activejob (= 8.0.3) activejob (= 8.1.2)
activerecord (= 8.0.3) activerecord (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
marcel (~> 1.0) marcel (~> 1.0)
activesupport (8.0.3) activesupport (8.1.2)
base64 base64
benchmark (>= 0.3)
bigdecimal bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1) concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5) connection_pool (>= 2.2.5)
drb drb
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
json
logger (>= 1.4.2) logger (>= 1.4.2)
minitest (>= 5.1) minitest (>= 5.1)
securerandom (>= 0.3) securerandom (>= 0.3)
@@ -657,20 +660,20 @@ GEM
rack (>= 1.3) rack (>= 1.3)
rackup (2.3.1) rackup (2.3.1)
rack (>= 3) rack (>= 3)
rails (8.0.3) rails (8.1.2)
actioncable (= 8.0.3) actioncable (= 8.1.2)
actionmailbox (= 8.0.3) actionmailbox (= 8.1.2)
actionmailer (= 8.0.3) actionmailer (= 8.1.2)
actionpack (= 8.0.3) actionpack (= 8.1.2)
actiontext (= 8.0.3) actiontext (= 8.1.2)
actionview (= 8.0.3) actionview (= 8.1.2)
activejob (= 8.0.3) activejob (= 8.1.2)
activemodel (= 8.0.3) activemodel (= 8.1.2)
activerecord (= 8.0.3) activerecord (= 8.1.2)
activestorage (= 8.0.3) activestorage (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 8.0.3) railties (= 8.1.2)
rails-dom-testing (2.3.0) rails-dom-testing (2.3.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
minitest minitest
@@ -681,9 +684,9 @@ GEM
rails-i18n (8.1.0) rails-i18n (8.1.0)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 8.0.0, < 9) railties (>= 8.0.0, < 9)
railties (8.0.3) railties (8.1.2)
actionpack (= 8.0.3) actionpack (= 8.1.2)
activesupport (= 8.0.3) activesupport (= 8.1.2)
irb (~> 1.13) irb (~> 1.13)
rackup (>= 1.0.0) rackup (>= 1.0.0)
rake (>= 12.2) rake (>= 12.2)
@@ -1050,7 +1053,7 @@ DEPENDENCIES
rack-attack (~> 6.6) rack-attack (~> 6.6)
rack-cors rack-cors
rack-test (~> 2.1) rack-test (~> 2.1)
rails (~> 8.0) rails (~> 8.1.0)
rails-i18n (~> 8.0) rails-i18n (~> 8.0)
rdf-normalize (~> 0.5) rdf-normalize (~> 0.5)
redcarpet (~> 3.6) redcarpet (~> 3.6)

View File

@@ -94,7 +94,7 @@ class Admin::Metrics::Measure::BaseMeasure
end end
def length_of_period def length_of_period
@length_of_period ||= @end_at - @start_at @length_of_period ||= @end_at.to_date - @start_at.to_date
end end
def params def params

View File

@@ -58,7 +58,7 @@ Bundler.require(:pam_authentication) if ENV['PAM_ENABLED'] == 'true'
module Mastodon module Mastodon
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 8.0 config.load_defaults 8.1
# Please, add to the `ignore` list any other `lib` subdirectories that do # 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. # not contain `.rb` files, or that should not be reloaded or eager loaded.

View File

@@ -28,7 +28,7 @@ Rails.application.configure do
config.cache_store = :redis_cache_store, REDIS_CONFIGURATION.cache config.cache_store = :redis_cache_store, REDIS_CONFIGURATION.cache
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}", 'cache-control' => "public, max-age=#{2.days.to_i}",
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
@@ -67,9 +67,18 @@ Rails.application.configure do
# Highlight code that triggered database queries in logs. # Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true config.active_record.verbose_query_logs = true
# Append comments with runtime information tags to SQL queries in logs.
config.active_record.query_log_tags_enabled = true
# Highlight code that enqueued background job in logs. # Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true config.active_job.verbose_enqueue_logs = true
# Highlight code that triggered redirect in logs.
config.action_dispatch.verbose_redirect_logs = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations. # Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true # config.i18n.raise_on_missing_translations = true

View File

@@ -11,8 +11,10 @@ Rails.application.configure do
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks). # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
config.eager_load = true config.eager_load = true
# Full error reports are disabled and caching is turned on. # Full error reports are disabled.
config.consider_all_requests_local = false config.consider_all_requests_local = false
# Turn on fragment caching in view templates.
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.
@@ -55,9 +57,8 @@ Rails.application.configure do
# Use a different cache store in production. # Use a different cache store in production.
config.cache_store = :redis_cache_store, REDIS_CONFIGURATION.cache config.cache_store = :redis_cache_store, REDIS_CONFIGURATION.cache
# Disable caching for Action Mailer templates even if Action Controller # Prevent health checks from clogging up the logs.
# caching is enabled. config.silence_healthcheck_path = '/health'
config.action_mailer.perform_caching = false
# Don't log any deprecations. # Don't log any deprecations.
config.active_support.report_deprecations = false config.active_support.report_deprecations = false
@@ -104,6 +105,9 @@ Rails.application.configure do
'Referrer-Policy' => 'same-origin', 'Referrer-Policy' => 'same-origin',
} }
# Only use :id for inspections in production.
config.active_record.attributes_for_inspect = [:id]
# Enable DNS rebinding protection and other `Host` header attacks. # Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [ # config.hosts = [
# "example.com", # Allow requests from example.com # "example.com", # Allow requests from example.com

View File

@@ -1,7 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
# TODO: Starting with Rails 7.0, the framework default is true for this setting. # In the Devise confirmations#show action, a redirect_to is called:
# This location in devise redirects and we can't hook in or override: # https://github.com/heartcombo/devise/blob/v5.0.0/app/controllers/devise/confirmations_controller.rb#L28
# https://github.com/heartcombo/devise/blob/v4.9.3/app/controllers/devise/confirmations_controller.rb#L28 #
# When solution is found, this setting can go back to default. # We override the `after_confirmation_path_for` method in a way which sometimes
Rails.application.config.action_controller.raise_on_open_redirects = false # returns raw URLs to external hosts, as part of the auth workflow.
# Discussion: https://github.com/mastodon/mastodon/pull/36505#discussion_r2782876831
Rails.application.reloader.to_prepare do
ActionController::Base.action_on_open_redirect = :log
end

View File

@@ -12,7 +12,7 @@ class RedirectWithVary < ActionDispatch::Routing::PathRedirect
end end
def redirect_with_vary(path) def redirect_with_vary(path)
RedirectWithVary.new(301, path) RedirectWithVary.new(301, path, caller(1..1).first)
end end
Rails.application.routes.draw do Rails.application.routes.draw do