File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
lib/log_struct/integrations Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ def self.setup(config)
4141 ActiveSupport . on_load ( :action_mailer ) { prepend LogStruct ::Integrations ::ActionMailer ::EventLogging }
4242 ActiveSupport . on_load ( :action_mailer ) { prepend LogStruct ::Integrations ::ActionMailer ::ErrorHandling }
4343 ActiveSupport . on_load ( :action_mailer ) { prepend LogStruct ::Integrations ::ActionMailer ::Callbacks }
44+ ActiveSupport . on_load ( :action_mailer ) { LogStruct ::Integrations ::ActionMailer ::Callbacks . patch_message_delivery }
4445
4546 true
4647 end
Original file line number Diff line number Diff line change @@ -16,14 +16,25 @@ module Callbacks
1616 # This will be handled by ActiveSupport::Concern at runtime
1717 included do
1818 include ::ActiveSupport ::Callbacks
19- # Rails < 7.1 does not support skip_after_callbacks_if_terminated option
2019 if defined? ( ::ActiveSupport ) && ::ActiveSupport . gem_version >= Gem ::Version . new ( "7.1.0" )
2120 define_callbacks :deliver , skip_after_callbacks_if_terminated : true
2221 else
2322 define_callbacks :deliver
2423 end
2524 end
2625
26+ # When this module is prepended (our integration uses prepend), ensure callbacks are defined
27+ if respond_to? ( :prepended )
28+ prepended do
29+ include ::ActiveSupport ::Callbacks
30+ if defined? ( ::ActiveSupport ) && ::ActiveSupport . gem_version >= Gem ::Version . new ( "7.1.0" )
31+ define_callbacks :deliver , skip_after_callbacks_if_terminated : true
32+ else
33+ define_callbacks :deliver
34+ end
35+ end
36+ end
37+
2738 # Define class methods in a separate module
2839 module ClassMethods
2940 extend T ::Sig
You can’t perform that action at this time.
0 commit comments