lib/spree_promo.rb in spree_promo-0.70.3 vs lib/spree_promo.rb in spree_promo-0.70.4

- old
+ new

@@ -52,7 +52,20 @@ initializer "spree.promo.register.promotions.actions" do |app| app.config.spree.promotions.actions = [Promotion::Actions::CreateAdjustment, Promotion::Actions::CreateLineItems] end + config.after_initialize do + ActiveSupport::Notifications.subscribe('spree.user.signup') do |*args| + event_name, start_time, end_time, id, payload = args + + # Used for storing promotions before order has been created + # Fixes #836 + ::Promotion.active.event_name_starts_with('spree.user.signup').each do |activator| + if activator.eligible?(nil, payload) && payload[:user] + payload[:user].promotions << activator + end + end + end + end end end