Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Allow to extend `after_accept` action for `Invitation` to add custom … (#12659)

Damian Legawiec121f231f2de3
diff --git a/core/app/models/spree/invitation.rb b/core/app/models/spree/invitation.rb
index 2c0dfa2ac6..2607bc3ee1 100644
--- a/core/app/models/spree/invitation.rb
+++ b/core/app/models/spree/invitation.rb
@@ -45,7 +45,7 @@ module Spree
event :accept do
transition pending: :accepted
end
- after_transition to: :accepted, do: [:create_resource_user, :set_accepted_at, :send_acceptance_notification]
+ after_transition to: :accepted, do: :after_accept
end
#
@@ -83,6 +83,13 @@ module Spree
private
+ # this method can be extended by developers now
+ def after_accept
+ create_resource_user
+ set_accepted_at
+ send_acceptance_notification
+ end
+
def send_invitation_email
Spree::InvitationMailer.invitation_email(self).deliver_later
end