Commit Graph

128 Commits

Author SHA1 Message Date
Rafael Mendonça França
1b455e2e9d
Rails 6.2 is now Rails 7.0
We have big plans for the next version of Rails and that
require big versions.
2021-02-04 16:47:16 +00:00
Rafael Mendonça França
6487836af8
Rails 7 requires Ruby 2.7 and prefer Ruby 3+
The code cleanup is comming in later commits but this
already remove support to Ruby < 2.7.
2021-02-04 16:34:53 +00:00
Yasuo Honda
51931f0bde Address Rails 7.0 will return Content-Type header without modification
This pull request addresses these warnings.

```ruby
$ cd actionmailbox
$ bin/test test/controllers/ingresses/relay/inbound_emails_controller_test.rb
Run options: --seed 32561

DEPRECATION WARNING: Rails 7.0 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead. (called from call at /home/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15)
...DEPRECATION WARNING: Rails 7.0 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead. (called from call at /home/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15)
..

Finished in 0.114883s, 43.5224 runs/s, 87.0447 assertions/s.
5 runs, 10 assertions, 0 failures, 0 errors, 0 skips
$
```

Follow-up https://github.com/rails/rails/commit/84055130713
related to https://github.com/rails/rails/pull/41251
2021-02-02 20:18:03 +09:00
George Claghorn
22f3dfe3cb
Upload raw email before creating pending ActionMailbox::InboundEmail
Fix that a storage upload error would leave behind a stuck-pending ActionMailbox::InboundEmail that could never be processed. The message isn't lost: the SMTP relay sees an HTTP server error and defers message delivery. We just have spurious, non-actionable InboundEmails stuck pending and tripping monitoring.

This does still leave behind an unattached ActiveStorage::Blob with no corresponding object on the storage service, but that's less annoying.
2021-01-04 09:28:09 -05:00
Ryuta Kamizono
2b0b5a75c0 Bump license years to 2021 [ci skip] 2021-01-01 12:21:20 +09:00
Rafael Mendonça França
59f7f5889e
Start Rails 6.2 development 🎉 2020-12-03 01:35:29 +00:00
Alex Ghiculescu
76e432341c Always recommend config.asset_host in examples 2020-11-30 16:33:51 -06:00
Rafael Mendonça França
8389f9902c
Preparing for 6.1.0.rc1 release 2020-11-02 21:12:47 +00:00
Eugene Kenny
b7eaaf73fb Update comment about reloading in development.rb [ci skip]
This comment predates the existence of `reload_classes_only_on_change`.
2020-11-02 19:36:26 +00:00
Omri Gabay
43d83e96c9
Add option to mute multiple database yaml warning
Adds an option to silence the warning that database configurations can
throw when it's unparsable.
2020-10-29 16:57:57 -04:00
Jonathan Hefner
33fdae0584 Fix backtraces for generated plugin tests
`Minitest.plugin_rails_init` sets `Minitest.backtrace_filter` to
`Rails.backtrace_cleaner` right before tests are run, overwriting the
value set in test_helper.rb.

`Rails.backtrace_cleaner` silences backtrace lines that do not start
with `Rails.root` followed by e.g. "lib/" or "test/".  Thus when
`Rails.root` is a subdirectory of the project directory -- for example,
when testing a plugin that has a dummy app -- all lines of the backtrace
are silenced.

This commit adds a fallback such that when all backtrace lines are
silenced, the original `Minitest.backtrace_filter` is used instead.

Additionally, this commit refactors and expands existing test coverage.
2020-10-07 15:40:56 -05:00
George Claghorn
11738e82cd Extract ActionMailbox::Record
Permit applications to hack in custom DB config for ActionMailbox::InboundEmail until Action Mailbox has first-class multi-DB support:

ActiveSupport.on_load(:action_mailbox_record) do
  connects_to reading: :action_mailbox_replica, writing: :action_mailbox_primary
end
2020-09-29 11:59:14 -04:00
bogdanvlviv
c15b5ab125
Eliminate fixture_file_upload related deprecation warnings in actionmailbox/test
https://buildkite.com/rails/rails/builds/71675#2b9c36e5-5504-4a8e-8c4d-af774e96ea16/954-982
https://buildkite.com/rails/rails/builds/71675#2b9c36e5-5504-4a8e-8c4d-af774e96ea16/954-988

```bash
.................DEPRECATION WARNING: Passing a path to `fixture_file_upload`
relative to `fixture_path` is deprecated.
In Rails 6.2, the path needs to be relative to `file_fixture_path`.

Please modify the call from
`fixture_file_upload("files/avatar1.jpeg")` to `fixture_file_upload("avatar1.jpeg")`.
DEPRECATION WARNING: Passing a path to `fixture_file_upload` relative to `fixture_path` is deprecated.
In Rails 6.2, the path needs to be relative to `file_fixture_path`.

Please modify the call from
`fixture_file_upload("files/avatar2.jpeg")` to `fixture_file_upload("avatar2.jpeg")`.
........................................................................
```

`fixture_file_upload` now uses path relative to `file_fixture_path`, see
https://github.com/rails/rails/pull/39086,
61c4be4777/actionmailbox/test/test_helper.rb (L21)
2020-09-21 16:14:20 +03:00
Akira Matsuda
47f5459138 Module#const_set is a public method 2020-09-15 17:19:37 +09:00
Mark Haussmann
71c8a89edd
Sendgrid: prepend X-Original-To header with envelope recipients
Sendgrid, like Mailgun, only passes BCC recipients as a parameter in the original JSON payload.

This PR adds code to prepend the recipients from the Sendgrid payload to the raw_email under the X-Original-To header.

References #38738.
2020-07-21 19:38:38 -04:00
Chris Oliver
12afb7fb4b
Allow passing URL params to conductor form for inbound emails 2020-07-14 14:02:43 -04:00
Petrik
2b09948637 Replace 'Stubs out' with 'Generates' in generator USAGE's [ci skip]
Generators generate things, but what is meant by 'Stubbing out' might
confuse beginners and non-native English speakers.
While generated tests are stubs that should have an implementation, a
generated model is a valid model that doesn't require any changes.
2020-06-03 08:51:47 +02:00
fatkodima
6c4f3be929 Unify raise_on_missing_translations for views and controllers 2020-05-20 02:42:59 +03:00
Prathamesh Sonpatki
a673ce69e7
Rename annotate_template_file_names to annotate_rendered_view_with_filenames
- Add the configuration option for annotating templates with file names to the generated app.
- Add `annotate_rendered_view_with_filenames` option to configuring guide.
2020-05-19 09:28:14 +05:30
Abhay Nikam
9b60273a62 Adds :inline option to Action Mailbox generator rails_command 2020-05-04 11:02:17 +05:30
David Heinemeier Hansson
666947089d Add option to set X-Original-To for systems that route on envelope addressing 2020-04-13 15:14:53 -07:00
Bill Cromie
fce29be335 Add a route to handle Mandrill's webhook URL check
Mandrill's Inbound API checks to see if a URL exists before it creates
the webhook. It sends a HEAD request, to which we now return a 200 OK
response to indicate that the route exists.

Now we can generate inbound API calls with ease on Mandrill, without
having to shuffle around tokens in production.

Fixes #37609.
2020-04-07 13:22:36 +01:00
Abhay Nikam
bdfffd1355 Update the Rails mailing list URLs to new discuss discourse URL [ci skip] 2020-04-02 22:00:28 +05:30
David Heinemeier Hansson
d56d2e7406
Add a way to deliver inbound emails by source (#38849)
* Add a way to deliver inbound emails by source

Great for testing when you get an eml file and can just paste it in.

* Test updates

* Fix tests

* Fix spacing
2020-03-31 16:46:13 -07:00
Joel Hawksley
a59e1de26a .annotate_template_file_names annotates HTML output with template file names
As a developer, when looking at a page in my web browser, it's sometimes
difficult to figure out which template(s) are being used to render the page.

config.action_view.annotate_template_file_names adds HTML comments to the
rendered output indicating where each template begins and ends.

Co-authored-by: Aaron Patterson <tenderlove@github.com>
2020-03-30 14:50:01 -06:00
David Heinemeier Hansson
3e0cdbeaf4
require, require_relative, load by double quotes (#38841)
* require, require_relative, load by double quotes

We're getting rid of all single quote usage, unless it serves a specific purpose, as per the general style guide.
2020-03-29 16:30:52 -07:00
Rikki Pitt
667d69cc5b
Add X-Original-To to mail using Mailgun recipient (#38738)
Expose the Mailgun SMTP recipient to Action Mailbox as X-Original-To, like Postfix.

Allows handling BCCed recipients who aren't listed in To/CC fields.
2020-03-23 18:10:48 -07:00
Ryuta Kamizono
1d3eb7be13 Fixup CHANGELOGs [ci skip] 2020-02-25 14:14:54 +09:00
Matthijs Vos
8dca5162f9
Replace Mailgun API key with signing key
Mailgun now needs the signing key instead of the API key for validating incoming mails.
2020-02-21 11:33:04 -05:00
aminamos
65cbbf2282 implemented review feedback and the original change from parent PR in app_base.rb 2020-02-12 13:31:43 -05:00
aminamos
7bb0706f2c update from PR #36222 2020-02-12 13:31:43 -05:00
Kasper Timm Hansen
420d533021
Merge pull request #37988 from abhaynikam/37823-change-action-mailbox-installer-to-generator
Add ActionMailbox install generator
2020-02-10 02:32:08 +01:00
Jonathan Hefner
f7b5019eea Remove redundant .gitignore entries
Follow-up to #37053.  The `*.sqlite3-*` .gitignore entries added in that
commit subsume previous `*.sqlite3-journal` entries.
2020-02-07 14:05:23 -06:00
Abhay Nikam
d8beb77252 Bump license years from 2019 to 2020 [ci skip] 2020-01-01 15:10:31 +05:30
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
Abhay Nikam
fc12d224ae Add ActionMailbox install generator
Forward ActionMailbox install to install generator and hide the ActionMailbox install generator from generator list

Updated the Action Mailbox install task description
2019-12-23 22:21:55 +05:30
Rafael Mendonça França
9e70042081
Merge pull request #28499 from grosser/grosser/puma
unify puma types and remove blocks
2019-12-18 10:23:08 -03:00
Eileen M. Uchitelle
cad13033fc
Merge pull request #37847 from pwim/action-mailbox-mail-ext-tests
Test extensions to Mail gem
2019-12-12 10:15:07 -05:00
George Claghorn
7d0327bbbf Track Active Storage variants in the database 2019-12-06 13:26:51 -05:00
Paul McMahon
40d63cee31 Test extensions to Mail gem
The from_address method is added to Mail::Message, but is not used
internally to ActionMailbox, nor tested (even implicitly). As it is part
of the public API, it feels important to at least have a basic test of
it.

Similarly, the x_original_to_addresses was only implicitly tested via
the recipients_addresses method. Given other similar methods are
explicitly tested, it feels like an oversight not to test it as well.

As the test introduced from_address didn't align with the naming of
RecipientsTest, I renamed it to the more generic AddressesTest.
2019-12-03 06:51:41 +09:00
glaszig
de862deb29 Fix Action Mailbox ingress config example [ci skip] 2019-10-14 21:58:30 -04:00
Orien Madgwick
493edf044f Add bug tracker/documentation/mailing list URIs to the gemspecs 2019-10-11 20:47:19 -04:00
Takayuki Nakata
43081fae4c Fix typo a InboxMailbox -> an InboxMailbox [ci skip] 2019-10-03 14:27:35 +09:00
DmitryTsepelev
e7f798c3f5 Allow configure services for individual attachments 2019-10-01 21:24:05 +03:00
Takayuki Nakata
fffb2b2a11 Fix typo in ActionMailbox::InboundEmail::MessageId [ci skip]
- `a Active Storage` -> `an Active Storage`
- `which be uploaded` -> `which is uploaded`
2019-09-17 17:40:49 +09:00
Yasuo Honda
c5e3c537a4 Ignore SQLite3 database files generated by parallel testing
Rails 6.0 introduces parallel testing and the default degree of parallelism is configured based on the number of CPU.
refer https://github.com/rails/rails/pull/34735 https://github.com/rails/rails/pull/31900

When any minitest executed under the OS where 2 or more CPU available,
SQLite 3 database files are not git-ignored.

Also updated other files which ignores SQLite database files.

* Steps to reproduce

```
$ git clone https://github.com/yahonda/rep_ignore_sqlite3_databases.git
$ cd rep_ignore_sqlite3_databases/
$ bin/rails test
$ git status
```

* Expected behavior:

- No `Untracked files:`

* Actual behavior:

- SQLite 3 database files appeared

```
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	db/test.sqlite3-0
	db/test.sqlite3-1
	db/test.sqlite3-2
	db/test.sqlite3-3
	db/test.sqlite3-4
	db/test.sqlite3-5

nothing added to commit but untracked files present (use "git add" to track)
$
```
2019-08-27 11:42:04 +00:00
Abhay Nikam
76ed911a91 Correct the assertion argument order 2019-08-08 00:06:34 +05:30
George Claghorn
c2f197c775 Correct assertion argument order 2019-08-07 10:54:56 -04:00
Michael Herold
ab34ed8acc Allow testing multipart emails in Action Mailbox
Allow passing a block to the create_inbound_email_from_mail and
receive_inbound_email_from_mail test helper methods.

When you wanted to test a multipart email -- for example, an email that
has both a plaintext part and an HTML part -- there wasn't a way to
easily build one without a pre-made fixture. By allowing you to pass a
block to these methods, we unlock the power of Mail.new to easily
create a variety of emails, from multi-part emails, to emails with
attachments, and beyond.
2019-08-07 10:12:13 -04:00
Akira Matsuda
af2129b4c7 Use try only when we're unsure if the receiver would respond_to the method 2019-08-01 17:58:00 +09:00