| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Adds `config.action_mailer.preview_enabled`
This allows mail previewing to be enabled easily in non-development
environments such as staging. The default is set to true for development
so no changes should be required to existing Rails applications.
The mail preview path can still be configured using the existing
`config.action_mailer.preview_path` configuration option.
Adding this avoids devs from having to do stuff like:
https://gist.github.com/lengarvey/fa2c9bd6cdbeba96526a
Update actionmailer/CHANGELOG with new configuration.
Update configuring guide with new configuratation.
Add `config.action_mailer.preview_path` to configuring guide.
|
|\ \
| | |
| | | |
Remove unused block parameter from #gsub call in AM::MailHelper#block_format
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
*TLDR*: The method is 4 times faster when log level is higher than DEBUG.
Also, the other two methods, `#deliver` and `#receive` have similar guard statements,
so this commit adds some symmetry to the code.
This is probably not the most critical part of ActionMailer in terms
of performance, but here are some benchmarks:
```
require 'benchmark/ips'
require 'action_mailer'
event = ActiveSupport::Notifications::Event.new(
'process.action_mailer',
Time.now,
Time.now,
'bf4e2b36ce085fd35b24',
{ mailer: "UserMailer", action: :welcome }
)
ActionMailer::Base.logger = ActiveSupport::Logger.new '/dev/null'
subscriber = ActionMailer::LogSubscriber.new
def subscriber.process_with_guard(event)
return unless logger.debug?
mailer = event.payload[:mailer]
action = event.payload[:action]
debug("\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms")
end
Benchmark.ips do |r|
ActionMailer::Base.logger.level = ::Logger::Severity::INFO
r.report('no guard') { subscriber.process(event) }
r.report(' guard') { subscriber.process_with_guard(event) }
end
__END__
Calculating -------------------------------------
no guard 9640 i/100ms
guard 38381 i/100ms
-------------------------------------------------
no guard 169166.9 (±10.2%) i/s - 838680 in 5.007262s
guard 728184.9 (±9.6%) i/s - 3607814 in 4.999218s
```
When log level is DEBUG, the _guarded_ method is a bit slower. This is a
good tradeoff for 4x improvement in production mode.
```
Benchmark.ips do |r|
ActionMailer::Base.logger.level = ::Logger::Severity::DEBUG
r.report('no guard') { subscriber.process(event) }
r.report(' guard') { subscriber.process_with_guard(event) }
end
__END__
Calculating -------------------------------------
no guard 4970 i/100ms
guard 4564 i/100ms
-------------------------------------------------
no guard 55617.4 (±3.5%) i/s - 278320 in 5.010523s
guard 49452.1 (±5.6%) i/s - 251020 in 5.093358s
```
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was partially broken because `preview_interceptors=` just assigned the
raw values, whithout going through `register_preview_interceptor`. Now the
Action Mailer railtie takes care of the `preview_interceptors` option.
This commit is a partial revert of:
Revert "Merge pull request #15739 from y-yagi/correct_doc_for_action_mailer_base"
This reverts commit a15704d7f35f17d34d0118546799141d6f853656, reversing
changes made to 1bd12a8609d275ad75fcc4b622ca4f5b32dc76be.
/cc @kuldeepaggarwal @y-yagi
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| |
| |
| | |
zuhao/refactor_actionview_register_template_handler
Add unregister_template_handler to prevent leaks.
Conflicts:
actionview/CHANGELOG.md
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
If i18n_with_controller_test.rb were to run first, the I18n.locale will
be changed to :de, and the following tests in base_test.rb will fail:
"subject gets default from I18n"
“default subject can have interpolations”
"translations are scoped properly"
"implicit multipart with default locale"
|
|
|
|
|
|
|
|
|
|
|
| |
`ActionMailer::Base.delivery_method` and
`ActionMailer::Base.perform_deliveries` have leaked states.
"delivery method can be customized per instance" and "delivery method
can be customized in subclasses not changing the parent" in
delivery_methods_test.rb will fail if test_helper_test.rb (in which
TestHelperMailerTest is inherited from ActionMailer::TestCase) runs
before it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows Rails users to install mail 2.6 which relaxes
the mime-types dependency, which is a big win for a lot of people.
Previously, the mail gem restricted mime-types to ~> 1.16
but now it has expanded to [">= 1.16", "< 3"]
And the mime-types maintainer will also be checking that
2.x releases don't break mail.
See https://github.com/mikel/mail/pull/713
https://rubygems.org/gems/mail/versions/2.6.0
|
|
|
|
| |
the issue tracker. See also #15455 [ci skip]
|
| |
|
|
|
|
|
| |
See also:
https://github.com/rails/rails/commit/3a297f8db75b172882bb3c2f9440d0c7365b8b11#commitcomment-6451708
|
| |
|
|\
| |
| |
| |
| | |
zuhao/refactor_actionmailer_i18n_with_controller_test
Use with_translation helper to clean up I18n stored translations.
|
| | |
|
|\ \
| | |
| | | |
Clean up deliveries after each test.
|
| |/ |
|
|\ \
| | |
| | | |
Do not clear deliveries in setup.
|
| |/ |
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
`BaseMailerPreview.welcome` is an instance method, so we need to stub the
method on a instance level and not on Class. The stub is important to make
sure the Message object is the same in the other expectations.
This was working randomly because Mocha uses == to compare two objects
on the `with()` expectation and even if the Mail::Message objects were
not the same object they are equal, but thats not the case in 100% of
the runs. So we need to make sure we use `.any_instance` method and have
the right message object.
|
|
|
|
| |
We should make sure we clean preview_interceptors after each test so they dont leaky to the next test
|
|\
| |
| |
| |
| | |
Conflicts:
guides/source/4_1_release_notes.md
|
| |
| |
| |
| | |
This commit also addresses rails/docrails#169 and rails/rails#14159
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This method return `Gem::Version.new(Rails.version)`, suggesting a more
reliable way to perform version comparison.
Example:
Rails.version #=> "4.1.2"
Rails.gem_version #=> #<Gem::Version "4.1.2">
Rails.version > "4.1.10" #=> false
Rails.gem_version > Gem::Version.new("4.1.10") #=> true
Gem::Requirement.new("~> 4.1.2") =~ Rails.gem_version #=> true
This was originally introduced as `.version` by @charliesome in #8501
but got reverted in #10002 since it was not backward compatible.
Also, updating template for `rake update_versions`.
|
| |
| |
| |
| | |
Remove 4-1 related entries from master [ci skip]
|
|/ |
|
|
|
| |
The errors were introduced in e220a34e39
|
|
|
|
| |
ref #14062
|
|\
| |
| |
| |
| |
| | |
Conflicts:
actionview/CHANGELOG.md
activerecord/CHANGELOG.md
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Test coverage improvement
|
| | | |
|
|\ \ \
| |/ /
|/| |
| | |
| | |
| | |
| | | |
Conflicts:
guides/source/active_record_validations.md
guides/source/api_documentation_guidelines.md
guides/source/configuring.md
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
We allow the use of underscored symbols to represent classes throughout
other parts of Rails so it seems incongruous that it's not supported in
`register_interceptor` and `register_observer`.
|
| | |
| | |
| | |
| | |
| | | |
Since preview_path is read from ActionMailer::Base when previewing, subclasses
can’t change it so don’t there's no need for the extra overhead imposed by using it.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
To support the ability for tools like CSS style inliners to operate on emails
being previewed this commit adds a hook in a similar fashion to the existing
delivery interceptor hook, e.g:
class CSSInlineStyler
def self.previewing_email(message)
# inline CSS styles
end
end
ActionMailer::Base.register_preview_interceptor CSSInlineStyler
Fixes #13622.
|
| | | |
|
| | | |
|