Remove deprecated ActionMailer::Base.receive
in favor of Action Mailbox
This commit is contained in:
parent
9817d74f3b
commit
d5fa9569a0
@ -1,3 +1,7 @@
|
||||
* Remove deprecated `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Fix ActionMailer assertions don't work for parameterized mail with legacy delivery job.
|
||||
|
||||
*bogdanvlviv*
|
||||
|
@ -547,32 +547,6 @@ def default(value = nil)
|
||||
# config.action_mailer.default_options = { from: "no-reply@example.org" }
|
||||
alias :default_options= :default
|
||||
|
||||
# Receives a raw email, parses it into an email object, decodes it,
|
||||
# instantiates a new mailer, and passes the email object to the mailer
|
||||
# object's +receive+ method.
|
||||
#
|
||||
# If you want your mailer to be able to process incoming messages, you'll
|
||||
# need to implement a +receive+ method that accepts the raw email string
|
||||
# as a parameter:
|
||||
#
|
||||
# class MyMailer < ActionMailer::Base
|
||||
# def receive(mail)
|
||||
# # ...
|
||||
# end
|
||||
# end
|
||||
def receive(raw_mail)
|
||||
ActiveSupport::Deprecation.warn(<<~MESSAGE.squish)
|
||||
ActionMailer::Base.receive is deprecated and will be removed in Rails 6.1.
|
||||
Use Action Mailbox to process inbound email.
|
||||
MESSAGE
|
||||
|
||||
ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
|
||||
mail = Mail.new(raw_mail)
|
||||
set_payload_for_mail(payload, mail)
|
||||
new.receive(mail)
|
||||
end
|
||||
end
|
||||
|
||||
# Wraps an email delivery inside of <tt>ActiveSupport::Notifications</tt> instrumentation.
|
||||
#
|
||||
# This method is actually called by the <tt>Mail::Message</tt> object itself
|
||||
|
@ -20,12 +20,6 @@ def deliver(event)
|
||||
debug { event.payload[:mail] }
|
||||
end
|
||||
|
||||
# An email was received.
|
||||
def receive(event)
|
||||
info { "Received mail (#{event.duration.round(1)}ms)" }
|
||||
debug { event.payload[:mail] }
|
||||
end
|
||||
|
||||
# An email was generated.
|
||||
def process(event)
|
||||
debug do
|
||||
|
@ -50,16 +50,4 @@ def test_deliver_message_when_perform_deliveries_is_false
|
||||
ensure
|
||||
BaseMailer.deliveries.clear
|
||||
end
|
||||
|
||||
def test_receive_is_notified
|
||||
fixture = File.read(File.expand_path("fixtures/raw_email", __dir__))
|
||||
assert_deprecated do
|
||||
TestMailer.receive(fixture)
|
||||
end
|
||||
wait
|
||||
assert_equal(1, @logger.logged(:info).size)
|
||||
assert_match(/Received mail/, @logger.logged(:info).first)
|
||||
assert_equal(1, @logger.logged(:debug).size)
|
||||
assert_match(/Jamis/, @logger.logged(:debug).first)
|
||||
end
|
||||
end
|
||||
|
166
guides/source/6_1_release_notes.md
Normal file
166
guides/source/6_1_release_notes.md
Normal file
@ -0,0 +1,166 @@
|
||||
**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.**
|
||||
|
||||
Ruby on Rails 6.1 Release Notes
|
||||
===============================
|
||||
|
||||
Highlights in Rails 6.1:
|
||||
|
||||
These release notes cover only the major changes. To learn about various bug
|
||||
fixes and changes, please refer to the change logs or check out the [list of
|
||||
commits](https://github.com/rails/rails/commits/master) in the main Rails
|
||||
repository on GitHub.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Upgrading to Rails 6.1
|
||||
----------------------
|
||||
|
||||
If you're upgrading an existing application, it's a great idea to have good test
|
||||
coverage before going in. You should also first upgrade to Rails 6.0 in case you
|
||||
haven't and make sure your application still runs as expected before attempting
|
||||
an update to Rails 6.1. A list of things to watch out for when upgrading is
|
||||
available in the
|
||||
[Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-6-0-to-rails-6-1)
|
||||
guide.
|
||||
|
||||
Major Features
|
||||
--------------
|
||||
|
||||
Railties
|
||||
--------
|
||||
|
||||
Please refer to the [Changelog][railties] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Action Cable
|
||||
------------
|
||||
|
||||
Please refer to the [Changelog][action-cable] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Action Pack
|
||||
-----------
|
||||
|
||||
Please refer to the [Changelog][action-pack] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Action View
|
||||
-----------
|
||||
|
||||
Please refer to the [Changelog][action-view] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Action Mailer
|
||||
-------------
|
||||
|
||||
Please refer to the [Changelog][action-mailer] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
* Remove deprecated `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Active Record
|
||||
-------------
|
||||
|
||||
Please refer to the [Changelog][active-record] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Active Storage
|
||||
--------------
|
||||
|
||||
Please refer to the [Changelog][active-storage] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Active Model
|
||||
------------
|
||||
|
||||
Please refer to the [Changelog][active-model] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Active Support
|
||||
--------------
|
||||
|
||||
Please refer to the [Changelog][active-support] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Active Job
|
||||
----------
|
||||
|
||||
Please refer to the [Changelog][active-job] for detailed changes.
|
||||
|
||||
### Removals
|
||||
|
||||
### Deprecations
|
||||
|
||||
### Notable changes
|
||||
|
||||
Ruby on Rails Guides
|
||||
--------------------
|
||||
|
||||
Please refer to the [Changelog][guides] for detailed changes.
|
||||
|
||||
### Notable changes
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
See the
|
||||
[full list of contributors to Rails](https://contributors.rubyonrails.org/)
|
||||
for the many people who spent many hours making Rails, the stable and robust
|
||||
framework it is. Kudos to all of them.
|
||||
|
||||
[railties]: https://github.com/rails/rails/blob/master/railties/CHANGELOG.md
|
||||
[action-pack]: https://github.com/rails/rails/blob/master/actionpack/CHANGELOG.md
|
||||
[action-view]: https://github.com/rails/rails/blob/master/actionview/CHANGELOG.md
|
||||
[action-mailer]: https://github.com/rails/rails/blob/master/actionmailer/CHANGELOG.md
|
||||
[action-cable]: https://github.com/rails/rails/blob/master/actioncable/CHANGELOG.md
|
||||
[active-record]: https://github.com/rails/rails/blob/master/activerecord/CHANGELOG.md
|
||||
[active-storage]: https://github.com/rails/rails/blob/master/activestorage/CHANGELOG.md
|
||||
[active-model]: https://github.com/rails/rails/blob/master/activemodel/CHANGELOG.md
|
||||
[active-support]: https://github.com/rails/rails/blob/master/activesupport/CHANGELOG.md
|
||||
[active-job]: https://github.com/rails/rails/blob/master/activejob/CHANGELOG.md
|
||||
[guides]: https://github.com/rails/rails/blob/master/guides/CHANGELOG.md
|
@ -226,6 +226,11 @@
|
||||
name: Upgrading Ruby on Rails
|
||||
url: upgrading_ruby_on_rails.html
|
||||
description: This guide helps in upgrading applications to latest Ruby on Rails versions.
|
||||
-
|
||||
name: Version 6.1 - May 2020
|
||||
url: 6_1_release_notes.html
|
||||
description: Release notes for Rails 6.0.
|
||||
work_in_progress: true
|
||||
-
|
||||
name: Version 6.0 - August 2019
|
||||
url: 6_0_release_notes.html
|
||||
|
@ -75,6 +75,8 @@ To allow you to upgrade to new defaults one by one, the update task has created
|
||||
Upgrading from Rails 6.0 to Rails 6.1
|
||||
-------------------------------------
|
||||
|
||||
For more information on changes made to Rails 6.1 please see the [release notes](6_1_release_notes.html).
|
||||
|
||||
### `Rails.application.config_for` return value no longer supports access with String keys.
|
||||
|
||||
Given a configuration file like this:
|
||||
|
Loading…
Reference in New Issue
Block a user