Skip to content

Commit e7ea111

Browse files
authored
Merge pull request rails#50144 from rails/rm-deprecations-1
Remove deprecations part 1
2 parents 6be9ba2 + 03dae98 commit e7ea111

31 files changed

+121
-427
lines changed

actionmailer/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
* Remove deprecated params via `:args` for `assert_enqueued_email_with`.
2+
3+
*Rafael Mendonça França*
4+
5+
* Remove deprecated `config.action_mailer.preview_path`.
6+
7+
*Rafael Mendonça França*
18

29
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionmailer/CHANGELOG.md) for previous changes.

actionmailer/lib/action_mailer/preview.rb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,7 @@ module Previews # :nodoc:
2525
mattr_accessor :preview_interceptors, instance_writer: false, default: [ActionMailer::InlinePreviewInterceptor]
2626
end
2727

28-
def preview_path
29-
ActionMailer.deprecator.warn(<<-MSG.squish)
30-
Using preview_path option is deprecated and will be removed in Rails 7.2.
31-
Please use preview_paths instead.
32-
MSG
33-
self.class.preview_paths.first
34-
end
35-
3628
module ClassMethods
37-
def preview_path=(value)
38-
ActionMailer.deprecator.warn(<<-MSG.squish)
39-
Using preview_path= option is deprecated and will be removed in Rails 7.2.
40-
Please use preview_paths= instead.
41-
MSG
42-
self.preview_paths << value
43-
end
44-
45-
def preview_path
46-
ActionMailer.deprecator.warn(<<-MSG.squish)
47-
Using preview_path option is deprecated and will be removed in Rails 7.2.
48-
Please use preview_paths instead.
49-
MSG
50-
self.preview_paths.first
51-
end
52-
5329
# Register one or more Interceptors which will be called before mail is previewed.
5430
def register_preview_interceptors(*interceptors)
5531
interceptors.flatten.compact.each { |interceptor| register_preview_interceptor(interceptor) }

actionmailer/lib/action_mailer/test_helper.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -160,26 +160,6 @@ def assert_enqueued_email_with(mailer, method, params: nil, args: nil, queue: ni
160160
mailer = mailer.instance_variable_get(:@mailer)
161161
end
162162

163-
if args.is_a?(Hash)
164-
ActionMailer.deprecator.warn <<~MSG
165-
Passing a Hash to the assert_enqueued_email_with :args kwarg causes the
166-
Hash to be treated as params. This behavior is deprecated and will be
167-
removed in Rails 7.2.
168-
169-
To specify a params Hash, use the :params kwarg:
170-
171-
assert_enqueued_email_with MyMailer, :my_method, params: { my_param: "value" }
172-
173-
Or, to specify named mailer args as a Hash, wrap the Hash in an array:
174-
175-
assert_enqueued_email_with MyMailer, :my_method, args: [{ my_arg: "value" }]
176-
# OR
177-
assert_enqueued_email_with MyMailer, :my_method, args: [my_arg: "value"]
178-
MSG
179-
180-
params, args = args, nil
181-
end
182-
183163
args = Array(args) unless args.is_a?(Proc)
184164
queue ||= mailer.deliver_later_queue_name || ActiveJob::Base.default_queue_name
185165

actionmailer/test/test_helper_test.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,9 @@ def test_assert_enqueued_email_with_with_no_block_with_args
432432

433433
def test_assert_enqueued_email_with_with_parameterized_args
434434
assert_nothing_raised do
435-
assert_deprecated(ActionMailer.deprecator) do
436-
assert_enqueued_email_with TestHelperMailer, :test_parameter_args, args: { all: "good" } do
437-
silence_stream($stdout) do
438-
TestHelperMailer.with(all: "good").test_parameter_args.deliver_later
439-
end
435+
assert_enqueued_email_with TestHelperMailer, :test_parameter_args, params: { all: "good" } do
436+
silence_stream($stdout) do
437+
TestHelperMailer.with(all: "good").test_parameter_args.deliver_later
440438
end
441439
end
442440
end
@@ -487,9 +485,7 @@ def test_assert_enqueued_email_with_with_no_block_with_parameterized_args
487485
silence_stream($stdout) do
488486
TestHelperMailer.with(all: "good").test_parameter_args.deliver_later
489487
end
490-
assert_deprecated(ActionMailer.deprecator) do
491-
assert_enqueued_email_with TestHelperMailer, :test_parameter_args, args: { all: "good" }
492-
end
488+
assert_enqueued_email_with TestHelperMailer, :test_parameter_args, params: { all: "good" }
493489
end
494490
end
495491

actionpack/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
* Remove deprecated support to set `Rails.application.config.action_dispatch.show_exceptions` to `true` and `false`.
2+
3+
*Rafael Mendonça França*
4+
5+
* Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.
6+
7+
*Rafael Mendonça França*
8+
9+
* Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.
10+
11+
*Rafael Mendonça França*
12+
13+
* Deprecate `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
14+
15+
*Rafael Mendonça França*
16+
17+
* Remove deprecated comparison between `ActionController::Parameters` and `Hash`.
18+
19+
*Rafael Mendonça França*
20+
21+
* Remove deprecated constant `AbstractController::Helpers::MissingHelperError`.
22+
23+
*Rafael Mendonça França*
24+
125
* Fix a race condition that could cause a `Text file busy - chromedriver`
226
error with parallel system tests
327

@@ -6,5 +30,8 @@
630
* Add `racc` as a dependency since it will become a bundled gem in Ruby 3.4.0
731

832
*Hartley McGuire*
33+
* Remove deprecated constant `ActionDispatch::IllegalStateError`.
34+
35+
*Rafael Mendonça França*
936

1037
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionpack/CHANGELOG.md) for previous changes.

actionpack/lib/abstract_controller/helpers.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
module AbstractController
77
module Helpers
8-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
98
extend ActiveSupport::Concern
109

1110
included do
@@ -24,23 +23,6 @@ module Helpers
2423
self._helpers = define_helpers_module(self)
2524
end
2625

27-
class DeprecatedMissingHelperError < LoadError
28-
def initialize(error, path)
29-
@error = error
30-
@path = "helpers/#{path}.rb"
31-
set_backtrace error.backtrace
32-
33-
if /^#{path}(\.rb)?$/.match?(error.path)
34-
super("Missing helper file helpers/%s.rb" % path)
35-
else
36-
raise error
37-
end
38-
end
39-
end
40-
deprecate_constant "MissingHelperError", "AbstractController::Helpers::DeprecatedMissingHelperError",
41-
message: "AbstractController::Helpers::MissingHelperError has been deprecated. If a Helper is not present, a NameError will be raised instead.",
42-
deprecator: AbstractController.deprecator
43-
4426
def _helpers
4527
self.class._helpers
4628
end

actionpack/lib/action_controller/metal/strong_parameters.rb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,21 @@ class Parameters
242242
# config.action_controller.always_permitted_parameters = %w( controller action format )
243243
cattr_accessor :always_permitted_parameters, default: %w( controller action )
244244

245-
cattr_accessor :allow_deprecated_parameters_hash_equality, default: true, instance_accessor: false
246-
247245
class << self
246+
def allow_deprecated_parameters_hash_equality
247+
ActionController.deprecator.warn <<-WARNING.squish
248+
`Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality` is
249+
deprecated and will be removed in Rails 7.3.
250+
WARNING
251+
end
252+
253+
def allow_deprecated_parameters_hash_equality=(value)
254+
ActionController.deprecator.warn <<-WARNING.squish
255+
`Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`
256+
is deprecated and will be removed in Rails 7.3.
257+
WARNING
258+
end
259+
248260
def nested_attribute?(key, value) # :nodoc:
249261
/\A-?\d+\z/.match?(key) && (value.is_a?(Hash) || value.is_a?(Parameters))
250262
end
@@ -284,20 +296,7 @@ def ==(other)
284296
if other.respond_to?(:permitted?)
285297
permitted? == other.permitted? && parameters == other.parameters
286298
else
287-
if self.class.allow_deprecated_parameters_hash_equality && Hash === other
288-
ActionController.deprecator.warn <<-WARNING.squish
289-
Comparing equality between `ActionController::Parameters` and a
290-
`Hash` is deprecated and will be removed in Rails 7.2. Please only do
291-
comparisons between instances of `ActionController::Parameters`. If
292-
you need to compare to a hash, first convert it using
293-
`ActionController::Parameters#new`.
294-
To disable the deprecated behavior set
295-
`Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false`.
296-
WARNING
297-
@parameters == other
298-
else
299-
super
300-
end
299+
super
301300
end
302301
end
303302

actionpack/lib/action_dispatch.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,8 @@ module Rack # :nodoc:
4444
# such as MIME-type negotiation, decoding parameters in POST, PATCH, or PUT
4545
# bodies, handling HTTP caching logic, cookies and sessions.
4646
module ActionDispatch
47-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
4847
extend ActiveSupport::Autoload
4948

50-
class DeprecatedIllegalStateError < StandardError
51-
end
52-
deprecate_constant "IllegalStateError", "ActionDispatch::DeprecatedIllegalStateError",
53-
message: "ActionDispatch::IllegalStateError is deprecated without replacement.",
54-
deprecator: ActionDispatch.deprecator
55-
5649
class MissingController < NameError
5750
end
5851

actionpack/lib/action_dispatch/http/mime_negotiation.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@ class InvalidType < ::Mime::Type::InvalidMimeType; end
1616

1717
included do
1818
mattr_accessor :ignore_accept_header, default: false
19-
20-
def return_only_media_type_on_content_type=(value)
21-
ActionDispatch.deprecator.warn(
22-
"`config.action_dispatch.return_only_request_media_type_on_content_type` is deprecated and will" \
23-
" be removed in Rails 7.2."
24-
)
25-
end
26-
27-
def return_only_media_type_on_content_type
28-
ActionDispatch.deprecator.warn(
29-
"`config.action_dispatch.return_only_request_media_type_on_content_type` is deprecated and will" \
30-
" be removed in Rails 7.2."
31-
)
32-
end
3319
end
3420

3521
# The MIME type of the HTTP request, such as Mime[:xml].

actionpack/lib/action_dispatch/http/permissions_policy.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,25 +132,6 @@ def initialize_copy(other)
132132
end
133133
end
134134

135-
%w[speaker vibrate vr].each do |directive|
136-
define_method(directive) do |*sources|
137-
ActionDispatch.deprecator.warn(<<~MSG)
138-
The `#{directive}` permissions policy directive is deprecated
139-
and will be removed in Rails 7.2.
140-
141-
There is no browser support for this directive, and no plan
142-
for browser support in the future. You can just remove this
143-
directive from your application.
144-
MSG
145-
146-
if sources.first
147-
@directives[directive] = apply_mappings(sources)
148-
else
149-
@directives.delete(directive)
150-
end
151-
end
152-
end
153-
154135
def build(context = nil)
155136
build_directives(context).compact.join("; ")
156137
end

0 commit comments

Comments
 (0)