mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Remove useless customer loading and clarify name
The method `associate_customer` only loads a customer but doesn't actually associate one. So the deleted line doesn't have any effect. The intention was to reset the customer after switching shops but the before_validation logic on the order model takes care of that already. I'm renaming this private method here for clarity.
This commit is contained in:
@@ -717,7 +717,7 @@ module Spree
|
||||
(user&.email || email)&.downcase
|
||||
end
|
||||
|
||||
def associate_customer
|
||||
def find_customer
|
||||
return customer if customer.present?
|
||||
|
||||
Customer.of(distributor).find_by(email: email_for_customer)
|
||||
@@ -738,7 +738,7 @@ module Spree
|
||||
end
|
||||
|
||||
def ensure_customer
|
||||
self.customer = associate_customer || create_customer
|
||||
self.customer = find_customer || create_customer
|
||||
end
|
||||
|
||||
def update_adjustment!(adjustment)
|
||||
|
||||
@@ -30,7 +30,6 @@ class OrderCartReset
|
||||
return unless current_user
|
||||
|
||||
order.associate_user!(current_user) if order.user.blank? || order.email.blank?
|
||||
order.__send__(:associate_customer) if order.customer.nil? # Only associates existing customers
|
||||
end
|
||||
|
||||
def reset_order_cycle(current_customer)
|
||||
|
||||
Reference in New Issue
Block a user