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
This commit is contained in:
luisramos0
2019-07-07 17:53:12 +01:00
parent b1cd950051
commit 05a72be273

View File

@@ -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?