Commit Graph

30 Commits

Author SHA1 Message Date
Haroon Ahmed
93f0cebd1d Display exception messages using simple_format for a better and clearer
exception message.
2020-11-09 21:48:24 +00:00
Eugene Kenny
96a1a2a37c Use binread instead of setting file mode manually
Followup to b31022052a54ef76f347973e23519ba86ffc94ff.
2020-05-13 00:05:32 +01:00
Stefan Wrobel
b9689aefe5 Add title tag to mailer previews 2019-09-02 14:44:46 -07:00
Thierry Joyal
963d11a000 [Rails::MailersController] Do not leak I18n global setting changes 2019-04-16 18:54:51 +00:00
Xavier Noria
821d6c694c Zeitwerk integration 2019-02-12 02:28:04 -08:00
Daniel Colson
94333a4c31 Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
Hitoshi Nakashima
5fe603ac28 Add locale selector to email preview (#31596)
- Add set_locale to detect suitable locale
- Make feature compatible with Rails 5.x
2018-01-18 15:22:10 -05:00
Koichi ITO
7c260ae201 Fix RuboCop offenses
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
2017-08-16 17:55:25 +09:00
Pat Allan
acea68de02 Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Alexey Zapparov
8e6c6d854c
Pass request params to ActionMailer::Preview 2017-03-01 20:54:14 +01:00
Eugene Kenny
ebededb372
Don't mutate raw_source in mailer preview interceptor
The raw_source method is documented as returning the exact value that
was used to create the body; mutating it breaks that contract.

Additionally, if the value used to create the body is blank, raw_source
returns a frozen string which causes the interceptor to raise an error.
2017-01-30 22:20:47 -07:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
783763bde9 applies new string literal convention in railties/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:16:09 +02:00
Gale Shafer
c05127c2fc Fix typo in mailer previews test description [ci skip]
A mailer preview test description misspelled the word configuration.
This commit updates the test description to spell the word correctly.
2016-07-14 10:18:30 -04:00
Prathamesh Sonpatki
d93427840e
Remove unused boot_rails method and it's usage
- The `boot_rails` method from abstract_unit.rb is empty after 2abcdfd978fdcd491576a237e8c6b.
- So let's remove it and its usage.
2016-07-04 09:34:21 +05:30
Wojciech Wnętrzak
472358d030 Fix displaying mailer previews on non local requests.
When config `action_mailer.show_previews` is set, previews are displayed
regardless of local request check.
2015-09-17 15:57:09 +02:00
Andrew White
faaed863dd Document inline image mailer preview interceptor
Explain what the interceptor is used for and how to remove it.
2015-05-04 19:46:51 +01:00
Andrew White
60239f3e5a Add support for inline images to mailer previews
Use a preview interceptor to search for inline cid: urls in src
attributes and convert them to data urls.
2015-05-04 10:56:59 +01:00
Andrew White
350d272d6c Fix mailer previews with attachments
Use the mail gem's own API to locate the correct part.

Fixes #14435.
2015-05-04 10:54:50 +01:00
Remo Mueller
f5132c19d5 Mailer preview now uses url_for to fix links to emails for apps running on a subdirectory, closes #19092. 2015-04-30 10:12:00 -04:00
Yves Senn
767d60156b mailer previews for NullMail instances. Closes #19849. 2015-04-28 16:00:08 +02:00
Rafael Mendonça França
d282125a18 Remove deprecate *_path helpers in email views 2015-01-04 11:58:42 -03:00
Oleg
ccc3ddb776 fixing mailer previews for apps with globbing route 2014-12-03 10:43:12 -05:00
@schneems and @sgrif
2bbcca004c Deprecate *_path methods in mailers
Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead.

Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR.

Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead.

The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`.

Paired @sgrif & @schneems
2014-07-30 12:01:45 -05:00
Rafael Mendonça França
72f58b0244 Rename preview_enabled option to show_previews 2014-07-01 13:09:24 -03:00
Leonard Garvey
84ed7b8dfe Add configuration to enable mail previews
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.
2014-07-01 14:39:59 +10:00
Andrew White
3713e43366 Add preview_path to autoload_paths in after_initialize
Only config.autoload_paths is frozen, so add the preview_path
to ActiveSupport::Dependencies.autoload_paths directly in an
after_initialize block. Also protect against a blank preview_path
being added to autoload_paths which can cause a serious slowdown
as Dir[] tries to load all *_preview.rb files under /

Fixes #13372
2014-01-04 18:42:34 +00:00
Andrew White
d6dec7fcb6 Add mailer previews feature based on mail_view gem 2013-12-17 03:58:35 +00:00