Skip to content

Verified customer wrong #4026

@derXear

Description

@derXear

Describe the bug
Consider the following two scenarios:

  1. User is making a Guest-Order and becomes a Customer entity with email a@b.com
  • No User entity is created for guest orders
  1. Another user is now registering with a@b.com and gets verified by an external authority
  • A second Customer entity is correctly created
  • A User entity is created, associated with the newly created customer and email verified

It's correct that two Customer entities exist in parallel as the first could have been a typo in the guest order, but the first customer should not be marked as verified in the Admin Dashboard.
The verification check is based on a email lookup of the user rather than the direct user-customer relationship

@michaelbromley The implementation appears intentional, but the reasoning behind it is unclear to me in customer-entity.resolver.ts:

@ResolveField()
user(@Ctx() ctx: RequestContext, @Parent() customer: Customer) {
    if (customer.user) {
        return customer.user;
    }

    return this.userService.getUserByEmailAddress(ctx, customer.emailAddress, 'customer');
}

Why not just return customer.user; and if undefined the customer is not verified?
At least it is misleading, as of cause that email address is verfified but the specific customer is not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions