mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Find customers by user id as well as email
Also fixing up a spec which became brittle due to too much mocking.
This commit is contained in:
@@ -718,7 +718,8 @@ module Spree
|
||||
end
|
||||
|
||||
def find_customer
|
||||
Customer.of(distributor).find_by(email: email_for_customer)
|
||||
user&.customers&.of(distributor)&.first ||
|
||||
Customer.of(distributor).find_by(email: email_for_customer)
|
||||
end
|
||||
|
||||
def create_customer
|
||||
|
||||
Reference in New Issue
Block a user