actionmailer 5.0.0.beta3 → 5.0.0.beta4
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 +29 -6
- data/lib/action_mailer/base.rb +5 -5
- data/lib/action_mailer/delivery_methods.rb +1 -1
- data/lib/action_mailer/gem_version.rb +1 -1
- data/lib/action_mailer/inline_preview_interceptor.rb +1 -1
- data/lib/action_mailer/message_delivery.rb +14 -2
- data/lib/action_mailer/railtie.rb +2 -2
- data/lib/action_mailer/test_case.rb +6 -3
- data/lib/rails/generators/mailer/mailer_generator.rb +16 -1
- data/lib/rails/generators/mailer/templates/application_mailer.rb +6 -0
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce7f1a0650cd648d2156eda7d9ec89f1daa9cd31
|
4
|
+
data.tar.gz: fe30768e0737f6963444df1992d2404ac6f368ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72f6b3639202328e7660922bdadc2072392dc54673cec489fc203d556cef9b1b19fd0f897956422a7f719447848049576cdd4cf27e17a70181b8e7c1cc5a845f
|
7
|
+
data.tar.gz: 3313a2002c0c4eb6b262d96d9c2763b204489e63bf2bfba4089e15e370e8f08e33f5a157ee5d2dade361604dbb802af34ee081c1ac58b9771d2b811be40b5516
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,32 @@
|
|
1
|
-
## Rails 5.0.0.
|
1
|
+
## Rails 5.0.0.beta4 (April 27, 2016) ##
|
2
|
+
|
3
|
+
* Disallow calling `#deliver_later` after making local modifications to
|
4
|
+
the message which would be lost when the delivery job is enqueued.
|
5
|
+
|
6
|
+
Prevents a common, hard-to-find bug like:
|
7
|
+
|
8
|
+
message = Notifier.welcome(user, foo)
|
9
|
+
message.message_id = my_generated_message_id
|
10
|
+
message.deliver_later
|
11
|
+
|
12
|
+
The message_id is silently lost! *Only the mailer arguments are passed
|
13
|
+
to the delivery job.*
|
14
|
+
|
15
|
+
This raises an exception now. Make modifications to the message within
|
16
|
+
the mailer method instead, or use a custom Active Job to manage delivery
|
17
|
+
instead of using #deliver_later.
|
2
18
|
|
3
|
-
*
|
19
|
+
*Jeremy Daer*
|
20
|
+
|
21
|
+
* Removes `-t` from default Sendmail arguments to match the underlying
|
22
|
+
`Mail::Sendmail` setting.
|
23
|
+
|
24
|
+
*Clayton Liggitt*
|
25
|
+
|
26
|
+
|
27
|
+
## Rails 5.0.0.beta3 (February 24, 2016) ##
|
4
28
|
|
5
|
-
|
29
|
+
* Add support for fragment caching in Action Mailer views.
|
6
30
|
|
7
31
|
*Stan Lo*
|
8
32
|
|
@@ -19,8 +43,7 @@
|
|
19
43
|
|
20
44
|
## Rails 5.0.0.beta1 (December 18, 2015) ##
|
21
45
|
|
22
|
-
* `config.
|
23
|
-
`config.action_mailer.default_url_options = { protocol: 'https' }`.
|
46
|
+
* `config.action_mailer.default_url_options[:protocol]` is now set to `https` if `config.force_ssl` is set to `true`.
|
24
47
|
|
25
48
|
*Andrew Kampjes*
|
26
49
|
|
@@ -29,7 +52,7 @@
|
|
29
52
|
|
30
53
|
*Chris McGrath*
|
31
54
|
|
32
|
-
* `assert_emails` in block form
|
55
|
+
* `assert_emails` in block form, uses the given number as expected value.
|
33
56
|
This makes the error message much easier to understand.
|
34
57
|
|
35
58
|
*Yuji Yaginuma*
|
data/lib/action_mailer/base.rb
CHANGED
@@ -86,7 +86,7 @@ module ActionMailer
|
|
86
86
|
# Like Action Controller, each mailer class has a corresponding view directory in which each
|
87
87
|
# method of the class looks for a template with its name.
|
88
88
|
#
|
89
|
-
# To define a template to be used with a
|
89
|
+
# To define a template to be used with a mailer, create an <tt>.erb</tt> file with the same
|
90
90
|
# name as the method in your mailer model. For example, in the mailer defined above, the template at
|
91
91
|
# <tt>app/views/notifier_mailer/welcome.text.erb</tt> would be used to generate the email.
|
92
92
|
#
|
@@ -144,7 +144,7 @@ module ActionMailer
|
|
144
144
|
# mail.deliver_now # generates and sends the email now
|
145
145
|
#
|
146
146
|
# The <tt>ActionMailer::MessageDelivery</tt> class is a wrapper around a delegate that will call
|
147
|
-
# your method to generate the mail. If you want direct access to delegator, or <tt>Mail::Message</tt>,
|
147
|
+
# your method to generate the mail. If you want direct access to the delegator, or <tt>Mail::Message</tt>,
|
148
148
|
# you can call the <tt>message</tt> method on the <tt>ActionMailer::MessageDelivery</tt> object.
|
149
149
|
#
|
150
150
|
# NotifierMailer.welcome(User.first).message # => a Mail::Message object
|
@@ -163,7 +163,7 @@ module ActionMailer
|
|
163
163
|
#
|
164
164
|
# Multipart messages can also be used implicitly because Action Mailer will automatically detect and use
|
165
165
|
# multipart templates, where each template is named after the name of the action, followed by the content
|
166
|
-
# type. Each such detected template will be added as a separate part
|
166
|
+
# type. Each such detected template will be added to the message, as a separate part.
|
167
167
|
#
|
168
168
|
# For example, if the following templates exist:
|
169
169
|
# * signup_notification.text.erb
|
@@ -288,8 +288,8 @@ module ActionMailer
|
|
288
288
|
# end
|
289
289
|
#
|
290
290
|
# Note that the proc is evaluated right at the start of the mail message generation, so if you
|
291
|
-
# set something in the default using a proc, and then set the same thing inside of your
|
292
|
-
# mailer method, it will get
|
291
|
+
# set something in the default hash using a proc, and then set the same thing inside of your
|
292
|
+
# mailer method, it will get overwritten by the mailer method.
|
293
293
|
#
|
294
294
|
# It is also possible to set these default options that will be used in all mailers through
|
295
295
|
# the <tt>default_options=</tt> configuration in <tt>config/application.rb</tt>:
|
@@ -3,7 +3,7 @@ require 'base64'
|
|
3
3
|
module ActionMailer
|
4
4
|
# Implements a mailer preview interceptor that converts image tag src attributes
|
5
5
|
# that use inline cid: style urls to data: style urls so that they are visible
|
6
|
-
# when previewing
|
6
|
+
# when previewing an HTML email in a web browser.
|
7
7
|
#
|
8
8
|
# This interceptor is enabled by default. To disable it, delete it from the
|
9
9
|
# <tt>ActionMailer::Base.preview_interceptors</tt> array:
|
@@ -18,6 +18,7 @@ module ActionMailer
|
|
18
18
|
@mailer = mailer
|
19
19
|
@mail_method = mail_method
|
20
20
|
@args = args
|
21
|
+
@obj = nil
|
21
22
|
end
|
22
23
|
|
23
24
|
def __getobj__ #:nodoc:
|
@@ -91,8 +92,19 @@ module ActionMailer
|
|
91
92
|
private
|
92
93
|
|
93
94
|
def enqueue_delivery(delivery_method, options={})
|
94
|
-
|
95
|
-
|
95
|
+
if @obj
|
96
|
+
raise "You've accessed the message before asking to deliver it " \
|
97
|
+
"later, so you may have made local changes that would be " \
|
98
|
+
"silently lost if we enqueued a job to deliver it. Why? Only " \
|
99
|
+
"the mailer method *arguments* are passed with the delivery job! " \
|
100
|
+
"Do not access the message in any way if you mean to deliver it " \
|
101
|
+
"later. Workarounds: 1. don't touch the message before calling " \
|
102
|
+
"#deliver_later, 2. only touch the message *within your mailer " \
|
103
|
+
"method*, or 3. use a custom Active Job instead of #deliver_later."
|
104
|
+
else
|
105
|
+
args = @mailer.name, @mail_method.to_s, delivery_method.to_s, *@args
|
106
|
+
ActionMailer::DeliveryJob.set(options).perform_later(*args)
|
107
|
+
end
|
96
108
|
end
|
97
109
|
end
|
98
110
|
end
|
@@ -45,9 +45,9 @@ module ActionMailer
|
|
45
45
|
register_observers(options.delete(:observers))
|
46
46
|
|
47
47
|
options.each { |k,v| send("#{k}=", v) }
|
48
|
-
|
49
|
-
ActionDispatch::IntegrationTest.send :include, ActionMailer::TestCase::ClearTestDeliveries
|
50
48
|
end
|
49
|
+
|
50
|
+
ActiveSupport.on_load(:action_dispatch_integration_test) { include ActionMailer::TestCase::ClearTestDeliveries }
|
51
51
|
end
|
52
52
|
|
53
53
|
initializer "action_mailer.compile_config_methods" do
|
@@ -15,11 +15,13 @@ module ActionMailer
|
|
15
15
|
extend ActiveSupport::Concern
|
16
16
|
|
17
17
|
included do
|
18
|
-
|
18
|
+
setup :clear_test_deliveries
|
19
|
+
teardown :clear_test_deliveries
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
22
|
-
|
23
|
+
|
24
|
+
def clear_test_deliveries
|
23
25
|
if ActionMailer::Base.delivery_method == :test
|
24
26
|
ActionMailer::Base.deliveries.clear
|
25
27
|
end
|
@@ -76,6 +78,7 @@ module ActionMailer
|
|
76
78
|
set_delivery_method :test
|
77
79
|
@old_perform_deliveries = ActionMailer::Base.perform_deliveries
|
78
80
|
ActionMailer::Base.perform_deliveries = true
|
81
|
+
ActionMailer::Base.deliveries.clear
|
79
82
|
end
|
80
83
|
|
81
84
|
def restore_test_deliveries # :nodoc:
|
@@ -89,6 +92,7 @@ module ActionMailer
|
|
89
92
|
end
|
90
93
|
|
91
94
|
def restore_delivery_method # :nodoc:
|
95
|
+
ActionMailer::Base.deliveries.clear
|
92
96
|
ActionMailer::Base.delivery_method = @old_delivery_method
|
93
97
|
end
|
94
98
|
|
@@ -114,6 +118,5 @@ module ActionMailer
|
|
114
118
|
end
|
115
119
|
|
116
120
|
include Behavior
|
117
|
-
include ClearTestDeliveries
|
118
121
|
end
|
119
122
|
end
|
@@ -9,13 +9,28 @@ module Rails
|
|
9
9
|
|
10
10
|
def create_mailer_file
|
11
11
|
template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}_mailer.rb")
|
12
|
+
|
13
|
+
in_root do
|
14
|
+
if self.behavior == :invoke && !File.exist?(application_mailer_file_name)
|
15
|
+
template 'application_mailer.rb', application_mailer_file_name
|
16
|
+
end
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
hook_for :template_engine, :test_framework
|
15
21
|
|
16
22
|
protected
|
17
23
|
def file_name
|
18
|
-
@_file_name ||= super.gsub(
|
24
|
+
@_file_name ||= super.gsub(/_mailer/i, '')
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def application_mailer_file_name
|
29
|
+
@_application_mailer_file_name ||= if mountable_engine?
|
30
|
+
"app/mailers/#{namespaced_path}/application_mailer.rb"
|
31
|
+
else
|
32
|
+
"app/mailers/application_mailer.rb"
|
33
|
+
end
|
19
34
|
end
|
20
35
|
end
|
21
36
|
end
|
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: 5.0.0.
|
4
|
+
version: 5.0.0.beta4
|
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: 2016-
|
11
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0.0.
|
19
|
+
version: 5.0.0.beta4
|
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: 5.0.0.
|
26
|
+
version: 5.0.0.beta4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionview
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.0.0.
|
33
|
+
version: 5.0.0.beta4
|
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: 5.0.0.
|
40
|
+
version: 5.0.0.beta4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activejob
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.0.0.
|
47
|
+
version: 5.0.0.beta4
|
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: 5.0.0.
|
54
|
+
version: 5.0.0.beta4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mail
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/action_mailer/version.rb
|
120
120
|
- lib/rails/generators/mailer/USAGE
|
121
121
|
- lib/rails/generators/mailer/mailer_generator.rb
|
122
|
+
- lib/rails/generators/mailer/templates/application_mailer.rb
|
122
123
|
- lib/rails/generators/mailer/templates/mailer.rb
|
123
124
|
homepage: http://rubyonrails.org
|
124
125
|
licenses:
|
@@ -141,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
142
|
requirements:
|
142
143
|
- none
|
143
144
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.6.4
|
145
146
|
signing_key:
|
146
147
|
specification_version: 4
|
147
148
|
summary: Email composition, delivery, and receiving framework (part of Rails).
|