From 05a72be273a151fd65692685f61b84ec9ff5e1c6 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Sun, 7 Jul 2019 17:53:12 +0100 Subject: [PATCH] Move handle_asynchronously :send_reset_password_instructions to after send_reset_password_instructions declaration This was as it was before the merge of user_decorator and user, the declaration was in the original class and the handle_asynchronously part was in the decorator which was loaded after the main user class from spree_auth_devise, this commit restores the order and fixes a spec in authentication_spec --- app/models/spree/user.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/spree/user.rb b/app/models/spree/user.rb index 138ea9f47b..8c56863932 100644 --- a/app/models/spree/user.rb +++ b/app/models/spree/user.rb @@ -21,10 +21,6 @@ module Spree scope :admin, lambda { includes(:spree_roles).where("#{roles_table_name}.name" => "admin") } scope :registered, where("#{users_table_name}.email NOT LIKE ?", "%@example.net") - # handle_asynchronously will define send_reset_password_instructions_with_delay. - # If handle_asynchronously is called twice, we get an infinite job loop. - handle_asynchronously :send_reset_password_instructions unless method_defined? :send_reset_password_instructions_with_delay - has_many :enterprise_roles, dependent: :destroy has_many :enterprises, through: :enterprise_roles has_many :owned_enterprises, class_name: 'Enterprise', foreign_key: :owner_id, inverse_of: :owner @@ -73,6 +69,9 @@ module Spree generate_reset_password_token! UserMailer.reset_password_instructions(self.id).deliver end + # handle_asynchronously will define send_reset_password_instructions_with_delay. + # If handle_asynchronously is called twice, we get an infinite job loop. + handle_asynchronously :send_reset_password_instructions unless method_defined? :send_reset_password_instructions_with_delay def known_users if admin?