DEV: Upgrade Rails to version 7.1 (#27539)

* DEV: Upgrade Rails to 7.1

* FIX: Remove references to `Rails.logger.chained`

`Rails.logger.chained` was provided by Logster before Rails 7.1
introduced their broadcast logger. Now all the loggers are added to
`Rails.logger.broadcasts`.

Some code in our initializers was still using `chained` instead of
`broadcasts`.

* DEV: Make parameters optional to all FakeLogger methods

* FIX: Set `override_level` on Logster loggers (#27519)

A followup to f595d599dd

* FIX: Don’t duplicate Rack response

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
Loïc Guitaut
2024-06-20 10:33:01 +02:00
committed by GitHub
parent 920aa2dfce
commit 2301dddcff
46 changed files with 436 additions and 256 deletions

View File

@@ -90,7 +90,7 @@ module Discourse
# tiny file needed by site settings
require "highlight_js"
config.load_defaults 6.1
config.load_defaults 7.0
config.active_record.cache_versioning = false # our custom cache class doesnt support this
config.action_controller.forgery_protection_origin_check = false
config.active_record.belongs_to_required_by_default = false
@@ -100,6 +100,9 @@ module Discourse
Time,
Symbol,
]
config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA1
config.action_dispatch.cookies_serializer = :hybrid
config.action_controller.wrap_parameters_by_default = false
# we skip it cause we configure it in the initializer
# the railtie for message_bus would insert it in the
@@ -112,8 +115,9 @@ module Discourse
ENV["DISCOURSE_MULTISITE_CONFIG_PATH"] || GlobalSetting.multisite_config_path
config.multisite_config_path = File.absolute_path(multisite_config_path, Rails.root)
config.autoload_lib(ignore: %w[common_passwords emoji generators javascripts tasks])
Rails.autoloaders.main.do_not_eager_load(config.root.join("lib"))
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths << "#{root}/lib"
config.autoload_paths << "#{root}/lib/guardian"
config.autoload_paths << "#{root}/lib/i18n"
config.autoload_paths << "#{root}/lib/validators"
@@ -240,6 +244,17 @@ module Discourse
# we got to clear the pool in case plugins connect
ActiveRecord::Base.connection_handler.clear_active_connections!
# Mailers and controllers may have been patched by plugins and when the
# application is eager loaded, the list of public methods is cached.
# We need to invalidate the existing caches, otherwise the new actions
# wont be seen by Rails.
if Rails.configuration.eager_load
AbstractController::Base.descendants.each do |controller|
controller.clear_action_methods!
controller.action_methods
end
end
end
require "rbtrace" if ENV["RBTRACE"] == "1"