aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-10-03 15:36:40 -0400
committerGeorge Claghorn <george@basecamp.com>2018-10-03 15:36:40 -0400
commitb9e220aa41674c974f5a1e8c4fe1684596cab740 (patch)
tree1e8d62f9720db4736d6497c9a900b343335763a4 /lib
parent7bf2cd437dd3b122aa1c8cb91c282cc9d699fc4c (diff)
downloadrails-b9e220aa41674c974f5a1e8c4fe1684596cab740.tar.gz
rails-b9e220aa41674c974f5a1e8c4fe1684596cab740.tar.bz2
rails-b9e220aa41674c974f5a1e8c4fe1684596cab740.zip
Terminate processing on bounce
Diffstat (limited to 'lib')
-rw-r--r--lib/action_mailbox/callbacks.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/action_mailbox/callbacks.rb b/lib/action_mailbox/callbacks.rb
index 33caaafd2a..e8bf2ffd55 100644
--- a/lib/action_mailbox/callbacks.rb
+++ b/lib/action_mailbox/callbacks.rb
@@ -5,8 +5,19 @@ module ActionMailbox
extend ActiveSupport::Concern
include ActiveSupport::Callbacks
+ TERMINATOR = ->(target, chain) do
+ terminate = true
+
+ catch(:abort) do
+ chain.call
+ terminate = target.inbound_email.bounced?
+ end
+
+ terminate
+ end
+
included do
- define_callbacks :process
+ define_callbacks :process, terminator: TERMINATOR
end
module ClassMethods