actionmailbox 6.1.4.1 → 7.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b80d262aa2fd158f3a45bcaab7f8d20ab993d0bca3a82738d94c5a349f54840
4
- data.tar.gz: 35f4a643c01f81353df94866959afd992914ffc16effcdd649a6124498b01fd4
3
+ metadata.gz: ae02e86aa2a5265ff0470966b50e0d3404ab2ff232d878e77956ca0ecbbe20a7
4
+ data.tar.gz: 4e6fe002432dd6608fda8019f3bae1bc6b3aef244188e49da1ae6cf91b1ba2a4
5
5
  SHA512:
6
- metadata.gz: 2b144bc3354b19eec3eeed6019813d9b3a2801a66e81e731bc691e2688dc1acfc90c3e989c0a9bc74baf825274c3feb6d1cd7864a4931a20ec1a249e52f810ae
7
- data.tar.gz: 658a39888fe57402cf94cac7604a2237f58cb640e9acbddcd3b22023029d5073f838bc3a0cc04778144d698c5956932d5ee46e49a1f63503442a5e128541fc09
6
+ metadata.gz: 742c4e19a3477dc658b97c23b48a20e1938167f55340f341277a28a99edc01f5491f57566dba070956367c938e0d32be7fdabeaaee45784954afca4c5ca64296
7
+ data.tar.gz: 202c51f947aacbfa52f476356adce380945eed8130bcf56fcbab2a9126feeed368649a69bdffecf255bcc2a30412d2ae06f153ff0fd0dcd0b5c4839ae22b6bf1
data/CHANGELOG.md CHANGED
@@ -1,81 +1,56 @@
1
- ## Rails 6.1.4.1 (August 19, 2021) ##
2
-
3
- * No changes.
4
-
5
-
6
- ## Rails 6.1.4 (June 24, 2021) ##
7
-
8
- * No changes.
9
-
10
-
11
- ## Rails 6.1.3.2 (May 05, 2021) ##
12
-
13
- * No changes.
14
-
15
-
16
- ## Rails 6.1.3.1 (March 26, 2021) ##
17
-
18
- * No changes.
1
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
19
2
 
3
+ * Removed deprecated environment variable `MAILGUN_INGRESS_API_KEY`.
20
4
 
21
- ## Rails 6.1.3 (February 17, 2021) ##
22
-
23
- * No changes.
24
-
25
-
26
- ## Rails 6.1.2.1 (February 10, 2021) ##
27
-
28
- * No changes.
29
-
5
+ *Rafael Mendonça França*
30
6
 
31
- ## Rails 6.1.2 (February 09, 2021) ##
7
+ * Removed deprecated `Rails.application.credentials.action_mailbox.mailgun_api_key`.
32
8
 
33
- * No changes.
9
+ *Rafael Mendonça França*
34
10
 
35
11
 
36
- ## Rails 6.1.1 (January 07, 2021) ##
12
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
37
13
 
38
14
  * No changes.
39
15
 
40
16
 
41
- ## Rails 6.1.0 (December 09, 2020) ##
42
-
43
- * Change default queue name of the incineration (`:action_mailbox_incineration`) and
44
- routing (`:action_mailbox_routing`) jobs to be the job adapter's default (`:default`).
45
-
46
- *Rafael Mendonça França*
47
-
48
- * Sendgrid ingress now passes through the envelope recipient as `X-Original-To`.
49
-
50
- *Mark Haussmann*
51
-
52
- * Update Mandrill inbound email route to respond appropriately to HEAD requests for URL health checks from Mandrill.
53
-
54
- *Bill Cromie*
17
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
55
18
 
56
- * Add way to deliver emails via source instead of filling out a form through the conductor interface.
19
+ * Add `attachments` to the list of permitted parameters for inbound emails conductor.
57
20
 
58
- *DHH*
21
+ When using the conductor to test inbound emails with attachments, this prevents an
22
+ unpermitted parameter warning in default configurations, and prevents errors for
23
+ applications that set:
59
24
 
60
- * Mailgun ingress now passes through the envelope recipient as `X-Original-To`.
25
+ ```ruby
26
+ config.action_controller.action_on_unpermitted_parameters = :raise
27
+ ```
61
28
 
62
- *Rikki Pitt*
29
+ *David Jones*, *Dana Henke*
63
30
 
64
- * Deprecate `Rails.application.credentials.action_mailbox.api_key` and `MAILGUN_INGRESS_API_KEY` in favor of `Rails.application.credentials.action_mailbox.signing_key` and `MAILGUN_INGRESS_SIGNING_KEY`.
31
+ * Add ability to configure ActiveStorage service
32
+ for storing email raw source.
65
33
 
66
- *Matthijs Vos*
34
+ ```yml
35
+ # config/storage.yml
36
+ incoming_emails:
37
+ service: Disk
38
+ root: /secure/dir/for/emails/only
39
+ ```
67
40
 
68
- * Allow easier creation of multi-part emails from the `create_inbound_email_from_mail` and `receive_inbound_email_from_mail` test helpers.
41
+ ```ruby
42
+ config.action_mailbox.storage_service = :incoming_emails
43
+ ```
69
44
 
70
- *Michael Herold*
45
+ *Yurii Rashkovskii*
71
46
 
72
- * Fix Bcc header not being included with emails from `create_inbound_email_from` test helpers.
47
+ * Add ability to incinerate an inbound message through the conductor interface.
73
48
 
74
- *jduff*
49
+ *Santiago Bartesaghi*
75
50
 
76
- * Add `ApplicationMailbox.mailbox_for` to expose mailbox routing.
51
+ * OpenSSL constants are now used for Digest computations.
77
52
 
78
- *James Dabbs*
53
+ *Dirkjan Bussink*
79
54
 
80
55
 
81
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionmailbox/CHANGELOG.md) for previous changes.
56
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailbox/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2020 Basecamp, LLC
3
+ Copyright (c) 2018-2021 Basecamp, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -77,21 +77,7 @@ module ActionMailbox
77
77
  end
78
78
 
79
79
  def key
80
- if Rails.application.credentials.dig(:action_mailbox, :mailgun_api_key)
81
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
82
- Rails.application.credentials.action_mailbox.api_key is deprecated and will be ignored in Rails 6.2.
83
- Use Rails.application.credentials.action_mailbox.signing_key instead.
84
- MSG
85
- Rails.application.credentials.dig(:action_mailbox, :mailgun_api_key)
86
- elsif ENV["MAILGUN_INGRESS_API_KEY"]
87
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
88
- The MAILGUN_INGRESS_API_KEY environment variable is deprecated and will be ignored in Rails 6.2.
89
- Use MAILGUN_INGRESS_SIGNING_KEY instead.
90
- MSG
91
- ENV["MAILGUN_INGRESS_API_KEY"]
92
- else
93
- Rails.application.credentials.dig(:action_mailbox, :mailgun_signing_key) || ENV["MAILGUN_INGRESS_SIGNING_KEY"]
94
- end
80
+ Rails.application.credentials.dig(:action_mailbox, :mailgun_signing_key) || ENV["MAILGUN_INGRESS_SIGNING_KEY"]
95
81
  end
96
82
 
97
83
  class Authenticator
@@ -57,7 +57,7 @@ module ActionMailbox
57
57
 
58
58
  private
59
59
  def require_valid_rfc822_message
60
- unless request.content_type == "message/rfc822"
60
+ unless request.media_type == "message/rfc822"
61
61
  head :unsupported_media_type
62
62
  end
63
63
  end
@@ -20,14 +20,18 @@ module Rails
20
20
 
21
21
  private
22
22
  def new_mail
23
- Mail.new(params.require(:mail).permit(:from, :to, :cc, :bcc, :x_original_to, :in_reply_to, :subject, :body).to_h).tap do |mail|
23
+ Mail.new(mail_params.except(:attachments).to_h).tap do |mail|
24
24
  mail[:bcc]&.include_in_headers = true
25
- params[:mail][:attachments].to_a.each do |attachment|
25
+ mail_params[:attachments].to_a.each do |attachment|
26
26
  mail.add_file(filename: attachment.original_filename, content: attachment.read)
27
27
  end
28
28
  end
29
29
  end
30
30
 
31
+ def mail_params
32
+ params.require(:mail).permit(:from, :to, :cc, :bcc, :x_original_to, :in_reply_to, :subject, :body, attachments: [])
33
+ end
34
+
31
35
  def create_inbound_email(mail)
32
36
  ActionMailbox::InboundEmail.create_and_extract_message_id!(mail.to_s)
33
37
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails
4
+ # Incinerating will destroy an email that is due and has already been processed.
5
+ class Conductor::ActionMailbox::IncineratesController < Rails::Conductor::BaseController
6
+ def create
7
+ ActionMailbox::InboundEmail.find(params[:inbound_email_id]).incinerate
8
+
9
+ redirect_to main_app.rails_conductor_inbound_emails_url
10
+ end
11
+ end
12
+ end
@@ -14,12 +14,11 @@ module ActionMailbox::InboundEmail::MessageId
14
14
  # attachment called +raw_email+. Before the upload, extract the Message-ID from the +source+ and set
15
15
  # it as an attribute on the new +InboundEmail+.
16
16
  def create_and_extract_message_id!(source, **options)
17
- message_checksum = Digest::SHA1.hexdigest(source)
17
+ message_checksum = OpenSSL::Digest::SHA1.hexdigest(source)
18
18
  message_id = extract_message_id(source) || generate_missing_message_id(message_checksum)
19
19
 
20
- create! options.merge(message_id: message_id, message_checksum: message_checksum) do |inbound_email|
21
- inbound_email.raw_email.attach io: StringIO.new(source), filename: "message.eml", content_type: "message/rfc822"
22
- end
20
+ create! raw_email: create_and_upload_raw_email!(source),
21
+ message_id: message_id, message_checksum: message_checksum, **options
23
22
  rescue ActiveRecord::RecordNotUnique
24
23
  nil
25
24
  end
@@ -34,5 +33,10 @@ module ActionMailbox::InboundEmail::MessageId
34
33
  logger.warn "Message-ID couldn't be parsed or is missing. Generated a new Message-ID: #{message_id}"
35
34
  end
36
35
  end
36
+
37
+ def create_and_upload_raw_email!(source)
38
+ ActiveStorage::Blob.create_and_upload! io: StringIO.new(source), filename: "message.eml", content_type: "message/rfc822",
39
+ service_name: ActionMailbox.storage_service
40
+ end
37
41
  end
38
42
  end
@@ -29,7 +29,7 @@ module ActionMailbox
29
29
 
30
30
  include Incineratable, MessageId, Routable
31
31
 
32
- has_one_attached :raw_email
32
+ has_one_attached :raw_email, service: ActionMailbox.storage_service
33
33
  enum status: %i[ pending processing delivered failed bounced ]
34
34
 
35
35
  def mail
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionMailbox
4
- class Record < ActiveRecord::Base #:nodoc:
4
+ class Record < ActiveRecord::Base # :nodoc:
5
5
  self.abstract_class = true
6
6
  end
7
7
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  <ul>
6
6
  <li><%= button_to "Route again", main_app.rails_conductor_inbound_email_reroute_path(@inbound_email), method: :post %></li>
7
- <li>Incinerate</li>
7
+ <li><%= button_to "Incinerate", main_app.rails_conductor_inbound_email_incinerate_path(@inbound_email), method: :post %></li>
8
8
  </ul>
9
9
 
10
10
  <details>
data/config/routes.rb CHANGED
@@ -21,5 +21,6 @@ Rails.application.routes.draw do
21
21
  post "inbound_emails/sources", to: "inbound_emails/sources#create", as: :rails_conductor_inbound_email_sources
22
22
 
23
23
  post ":inbound_email_id/reroute" => "reroutes#create", as: :rails_conductor_inbound_email_reroute
24
+ post ":inbound_email_id/incinerate" => "incinerates#create", as: :rails_conductor_inbound_email_incinerate
24
25
  end
25
26
  end
@@ -77,7 +77,7 @@ module ActionMailbox
77
77
  @inbound_email = inbound_email
78
78
  end
79
79
 
80
- def perform_processing #:nodoc:
80
+ def perform_processing # :nodoc:
81
81
  track_status_of_inbound_email do
82
82
  run_callbacks :process do
83
83
  process
@@ -92,7 +92,7 @@ module ActionMailbox
92
92
  # Overwrite in subclasses
93
93
  end
94
94
 
95
- def finished_processing? #:nodoc:
95
+ def finished_processing? # :nodoc:
96
96
  inbound_email.delivered? || inbound_email.bounced?
97
97
  end
98
98
 
@@ -20,6 +20,8 @@ module ActionMailbox
20
20
  config.action_mailbox.queues = ActiveSupport::InheritableOptions.new \
21
21
  incineration: :action_mailbox_incineration, routing: :action_mailbox_routing
22
22
 
23
+ config.action_mailbox.storage_service = nil
24
+
23
25
  initializer "action_mailbox.config" do
24
26
  config.after_initialize do |app|
25
27
  ActionMailbox.logger = app.config.action_mailbox.logger || Rails.logger
@@ -27,6 +29,7 @@ module ActionMailbox
27
29
  ActionMailbox.incinerate_after = app.config.action_mailbox.incinerate_after || 30.days
28
30
  ActionMailbox.queues = app.config.action_mailbox.queues || {}
29
31
  ActionMailbox.ingress = app.config.action_mailbox.ingress
32
+ ActionMailbox.storage_service = app.config.action_mailbox.storage_service
30
33
  end
31
34
  end
32
35
  end
@@ -7,10 +7,10 @@ module ActionMailbox
7
7
  end
8
8
 
9
9
  module VERSION
10
- MAJOR = 6
11
- MINOR = 1
12
- TINY = 4
13
- PRE = "1"
10
+ MAJOR = 7
11
+ MINOR = 0
12
+ TINY = 0
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -14,4 +14,5 @@ module ActionMailbox
14
14
  mattr_accessor :incinerate, default: true
15
15
  mattr_accessor :incinerate_after, default: 30.days
16
16
  mattr_accessor :queues, default: {}
17
+ mattr_accessor :storage_service
17
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.4.1
4
+ version: 7.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-08-19 00:00:00.000000000 Z
12
+ date: 2021-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,70 +17,70 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 6.1.4.1
20
+ version: 7.0.0.rc2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 6.1.4.1
27
+ version: 7.0.0.rc2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 6.1.4.1
34
+ version: 7.0.0.rc2
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 6.1.4.1
41
+ version: 7.0.0.rc2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: activestorage
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 6.1.4.1
48
+ version: 7.0.0.rc2
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 6.1.4.1
55
+ version: 7.0.0.rc2
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: activejob
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 6.1.4.1
62
+ version: 7.0.0.rc2
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 6.1.4.1
69
+ version: 7.0.0.rc2
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: actionpack
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 6.1.4.1
76
+ version: 7.0.0.rc2
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 6.1.4.1
83
+ version: 7.0.0.rc2
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: mail
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,7 @@ files:
114
114
  - app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
115
115
  - app/controllers/rails/conductor/action_mailbox/inbound_emails/sources_controller.rb
116
116
  - app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
117
+ - app/controllers/rails/conductor/action_mailbox/incinerates_controller.rb
117
118
  - app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb
118
119
  - app/controllers/rails/conductor/base_controller.rb
119
120
  - app/jobs/action_mailbox/incineration_job.rb
@@ -163,10 +164,11 @@ licenses:
163
164
  - MIT
164
165
  metadata:
165
166
  bug_tracker_uri: https://github.com/rails/rails/issues
166
- changelog_uri: https://github.com/rails/rails/blob/v6.1.4.1/actionmailbox/CHANGELOG.md
167
- documentation_uri: https://api.rubyonrails.org/v6.1.4.1/
167
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.0.rc2/actionmailbox/CHANGELOG.md
168
+ documentation_uri: https://api.rubyonrails.org/v7.0.0.rc2/
168
169
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
169
- source_code_uri: https://github.com/rails/rails/tree/v6.1.4.1/actionmailbox
170
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.0.rc2/actionmailbox
171
+ rubygems_mfa_required: 'true'
170
172
  post_install_message:
171
173
  rdoc_options: []
172
174
  require_paths:
@@ -175,12 +177,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
177
  requirements:
176
178
  - - ">="
177
179
  - !ruby/object:Gem::Version
178
- version: 2.5.0
180
+ version: 2.7.0
179
181
  required_rubygems_version: !ruby/object:Gem::Requirement
180
182
  requirements:
181
- - - ">="
183
+ - - ">"
182
184
  - !ruby/object:Gem::Version
183
- version: '0'
185
+ version: 1.3.1
184
186
  requirements: []
185
187
  rubygems_version: 3.2.15
186
188
  signing_key: