actionmailer 7.0.0.alpha2 → 7.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionmailer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/action_mailer/base.rb +9 -2
- data/lib/action_mailer/gem_version.rb +1 -1
- data/lib/action_mailer/message_delivery.rb +4 -34
- data/lib/action_mailer/parameterized.rb +2 -24
- data/lib/action_mailer/test_helper.rb +1 -2
- data/lib/action_mailer.rb +0 -1
- metadata +15 -15
- data/lib/action_mailer/delivery_job.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeaac20ea2d91009e6fb6e0e9f080316fe884071adc62627b3a5469699288535
|
4
|
+
data.tar.gz: b9db25aa1577ee0611ea79b8b4a6c1336a1102c4a0d6fd11ff4fe8ec8f38ecf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b30795e1a90f4de721aa9c1b1dbdfba9d7faa2b61b0623260d29be422f4b35f3fb7e3b074c79c35cadf5f6c4a666767462751326f76229e2cd9af2d5e6fc1e5
|
7
|
+
data.tar.gz: 6769fe17016fe9a091648514721b17d77daeb928cf20ff37af6e0a406de6c783159ac4567b3a3e4e3970bf673986b1df9e2d50a8aeeb335b21c92c70a68ab7e5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
* Remove deprecated `ActionMailer::DeliveryJob` and `ActionMailer::Parameterized::DeliveryJob`
|
2
|
+
in favor of `ActionMailer::MailDeliveryJob`.
|
3
|
+
|
4
|
+
*Rafael Mendonça França*
|
5
|
+
|
6
|
+
* `email_address_with_name` returns just the address if name is blank.
|
7
|
+
|
8
|
+
*Thomas Hutterer*
|
9
|
+
|
10
|
+
|
1
11
|
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
2
12
|
|
3
13
|
* No changes.
|
data/lib/action_mailer/base.rb
CHANGED
@@ -435,6 +435,9 @@ module ActionMailer
|
|
435
435
|
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
|
436
436
|
# <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
|
437
437
|
#
|
438
|
+
# * <tt>delivery_job</tt> - The job class used with <tt>deliver_later</tt>. Defaults to
|
439
|
+
# +ActionMailer::MailDeliveryJob+.
|
440
|
+
#
|
438
441
|
# * <tt>deliver_later_queue_name</tt> - The name of the queue used with <tt>deliver_later</tt>.
|
439
442
|
class Base < AbstractController::Base
|
440
443
|
include DeliveryMethods
|
@@ -459,7 +462,7 @@ module ActionMailer
|
|
459
462
|
|
460
463
|
helper ActionMailer::MailHelper
|
461
464
|
|
462
|
-
class_attribute :delivery_job, default: ::ActionMailer::
|
465
|
+
class_attribute :delivery_job, default: ::ActionMailer::MailDeliveryJob
|
463
466
|
class_attribute :default_params, default: {
|
464
467
|
mime_version: "1.0",
|
465
468
|
charset: "UTF-8",
|
@@ -563,10 +566,12 @@ module ActionMailer
|
|
563
566
|
end
|
564
567
|
|
565
568
|
# Returns an email in the format "Name <email@example.com>".
|
569
|
+
#
|
570
|
+
# If the name is a blank string, it returns just the address.
|
566
571
|
def email_address_with_name(address, name)
|
567
572
|
Mail::Address.new.tap do |builder|
|
568
573
|
builder.address = address
|
569
|
-
builder.display_name = name
|
574
|
+
builder.display_name = name.presence
|
570
575
|
end.to_s
|
571
576
|
end
|
572
577
|
|
@@ -638,6 +643,8 @@ module ActionMailer
|
|
638
643
|
end
|
639
644
|
|
640
645
|
# Returns an email in the format "Name <email@example.com>".
|
646
|
+
#
|
647
|
+
# If the name is a blank string, it returns just the address.
|
641
648
|
def email_address_with_name(address, name)
|
642
649
|
self.class.email_address_with_name(address, name)
|
643
650
|
end
|
@@ -62,7 +62,7 @@ module ActionMailer
|
|
62
62
|
# * <tt>:queue</tt> - Enqueue the email on the specified queue
|
63
63
|
# * <tt>:priority</tt> - Enqueues the email with the specified priority
|
64
64
|
#
|
65
|
-
# By default, the email will be enqueued using <tt>ActionMailer::
|
65
|
+
# By default, the email will be enqueued using <tt>ActionMailer::MailDeliveryJob</tt>. Each
|
66
66
|
# <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
|
67
67
|
# +delivery_job+.
|
68
68
|
#
|
@@ -88,7 +88,7 @@ module ActionMailer
|
|
88
88
|
# * <tt>:queue</tt> - Enqueue the email on the specified queue.
|
89
89
|
# * <tt>:priority</tt> - Enqueues the email with the specified priority
|
90
90
|
#
|
91
|
-
# By default, the email will be enqueued using <tt>ActionMailer::
|
91
|
+
# By default, the email will be enqueued using <tt>ActionMailer::MailDeliveryJob</tt>. Each
|
92
92
|
# <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
|
93
93
|
# +delivery_job+.
|
94
94
|
#
|
@@ -140,38 +140,8 @@ module ActionMailer
|
|
140
140
|
"#deliver_later, 2. only touch the message *within your mailer " \
|
141
141
|
"method*, or 3. use a custom Active Job instead of #deliver_later."
|
142
142
|
else
|
143
|
-
|
144
|
-
|
145
|
-
if use_new_args?(job)
|
146
|
-
job.set(options).perform_later(
|
147
|
-
@mailer_class.name, @action.to_s, delivery_method.to_s, args: @args)
|
148
|
-
elsif job <= DeliveryJob
|
149
|
-
job.set(options).perform_later(
|
150
|
-
@mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
|
151
|
-
else
|
152
|
-
ActiveSupport::Deprecation.warn(<<~EOM)
|
153
|
-
In Rails 7.0, Action Mailer will pass the mail arguments inside the `:args` keyword argument.
|
154
|
-
The `perform` method of the #{job} needs to change and forward the mail arguments
|
155
|
-
from the `args` keyword argument.
|
156
|
-
|
157
|
-
The `perform` method should now look like:
|
158
|
-
|
159
|
-
`def perform(mailer, mail_method, delivery, args:)`
|
160
|
-
EOM
|
161
|
-
|
162
|
-
job.set(options).perform_later(
|
163
|
-
@mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
def use_new_args?(job)
|
169
|
-
parameters = job.public_instance_method(:perform).parameters
|
170
|
-
|
171
|
-
parameters.find do |key, name|
|
172
|
-
return true if key == :keyreq && name == :args
|
173
|
-
|
174
|
-
key == :keyrest
|
143
|
+
@mailer_class.delivery_job.set(options).perform_later(
|
144
|
+
@mailer_class.name, @action.to_s, delivery_method.to_s, args: @args)
|
175
145
|
end
|
176
146
|
end
|
177
147
|
end
|
@@ -122,13 +122,6 @@ module ActionMailer
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
class DeliveryJob < ActionMailer::DeliveryJob # :nodoc:
|
126
|
-
def perform(mailer, mail_method, delivery_method, params, *args)
|
127
|
-
mailer.constantize.with(params).public_send(mail_method, *args).send(delivery_method)
|
128
|
-
end
|
129
|
-
ruby2_keywords(:perform)
|
130
|
-
end
|
131
|
-
|
132
125
|
class MessageDelivery < ActionMailer::MessageDelivery # :nodoc:
|
133
126
|
def initialize(mailer_class, action, params, *args)
|
134
127
|
super(mailer_class, action, *args)
|
@@ -148,23 +141,8 @@ module ActionMailer
|
|
148
141
|
if processed?
|
149
142
|
super
|
150
143
|
else
|
151
|
-
|
152
|
-
|
153
|
-
if job <= MailDeliveryJob
|
154
|
-
job.set(options).perform_later(
|
155
|
-
@mailer_class.name, @action.to_s, delivery_method.to_s, params: @params, args: @args)
|
156
|
-
else
|
157
|
-
job.set(options).perform_later(
|
158
|
-
@mailer_class.name, @action.to_s, delivery_method.to_s, @params, *@args)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def delivery_job_class
|
164
|
-
if @mailer_class.delivery_job <= MailDeliveryJob
|
165
|
-
@mailer_class.delivery_job
|
166
|
-
else
|
167
|
-
Parameterized::DeliveryJob
|
144
|
+
@mailer_class.delivery_job.set(options).perform_later(
|
145
|
+
@mailer_class.name, @action.to_s, delivery_method.to_s, params: @params, args: @args)
|
168
146
|
end
|
169
147
|
end
|
170
148
|
end
|
@@ -155,8 +155,7 @@ module ActionMailer
|
|
155
155
|
def delivery_job_filter(job)
|
156
156
|
job_class = job.is_a?(Hash) ? job.fetch(:job) : job.class
|
157
157
|
|
158
|
-
Base.descendants.map(&:delivery_job).include?(job_class)
|
159
|
-
ActionMailer::Parameterized::DeliveryJob == job_class
|
158
|
+
Base.descendants.map(&:delivery_job).include?(job_class)
|
160
159
|
end
|
161
160
|
end
|
162
161
|
end
|
data/lib/action_mailer.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.0.
|
4
|
+
version: 7.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.0.0.
|
19
|
+
version: 7.0.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.0.0.
|
26
|
+
version: 7.0.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 7.0.0.
|
33
|
+
version: 7.0.0.rc1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 7.0.0.
|
40
|
+
version: 7.0.0.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: actionview
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 7.0.0.
|
47
|
+
version: 7.0.0.rc1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 7.0.0.
|
54
|
+
version: 7.0.0.rc1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activejob
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 7.0.0.
|
61
|
+
version: 7.0.0.rc1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 7.0.0.
|
68
|
+
version: 7.0.0.rc1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mail
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,6 @@ files:
|
|
113
113
|
- lib/action_mailer.rb
|
114
114
|
- lib/action_mailer/base.rb
|
115
115
|
- lib/action_mailer/collector.rb
|
116
|
-
- lib/action_mailer/delivery_job.rb
|
117
116
|
- lib/action_mailer/delivery_methods.rb
|
118
117
|
- lib/action_mailer/gem_version.rb
|
119
118
|
- lib/action_mailer/inline_preview_interceptor.rb
|
@@ -137,10 +136,11 @@ licenses:
|
|
137
136
|
- MIT
|
138
137
|
metadata:
|
139
138
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
140
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.0.0.
|
141
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.0.
|
139
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.0.rc1/actionmailer/CHANGELOG.md
|
140
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.0.rc1/
|
142
141
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
143
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.0.
|
142
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.0.rc1/actionmailer
|
143
|
+
rubygems_mfa_required: 'true'
|
144
144
|
post_install_message:
|
145
145
|
rdoc_options: []
|
146
146
|
require_paths:
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: 1.3.1
|
158
158
|
requirements:
|
159
159
|
- none
|
160
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.2.22
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Email composition and delivery framework (part of Rails).
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_job"
|
4
|
-
|
5
|
-
module ActionMailer
|
6
|
-
# The <tt>ActionMailer::DeliveryJob</tt> class is used when you
|
7
|
-
# want to send emails outside of the request-response cycle.
|
8
|
-
#
|
9
|
-
# Exceptions are rescued and handled by the mailer class.
|
10
|
-
class DeliveryJob < ActiveJob::Base # :nodoc:
|
11
|
-
queue_as { ActionMailer::Base.deliver_later_queue_name }
|
12
|
-
|
13
|
-
rescue_from StandardError, with: :handle_exception_with_mailer_class
|
14
|
-
|
15
|
-
before_perform do
|
16
|
-
ActiveSupport::Deprecation.warn <<~MSG.squish
|
17
|
-
Sending mail with DeliveryJob and Parameterized::DeliveryJob
|
18
|
-
is deprecated and will be removed in Rails 7.0.
|
19
|
-
Please use MailDeliveryJob instead.
|
20
|
-
MSG
|
21
|
-
end
|
22
|
-
|
23
|
-
def perform(mailer, mail_method, delivery_method, *args) # :nodoc:
|
24
|
-
mailer.constantize.public_send(mail_method, *args).send(delivery_method)
|
25
|
-
end
|
26
|
-
ruby2_keywords(:perform)
|
27
|
-
|
28
|
-
private
|
29
|
-
# "Deserialize" the mailer class name by hand in case another argument
|
30
|
-
# (like a Global ID reference) raised DeserializationError.
|
31
|
-
def mailer_class
|
32
|
-
if mailer = Array(@serialized_arguments).first || Array(arguments).first
|
33
|
-
mailer.constantize
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def handle_exception_with_mailer_class(exception)
|
38
|
-
if klass = mailer_class
|
39
|
-
klass.handle_exception exception
|
40
|
-
else
|
41
|
-
raise exception
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|