Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use full email instead of trimmed

dominik-zeglen7a74b385824f
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index b06dfdf98b..3a920ac13a 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -12,7 +12,7 @@ import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
-import { maybe } from "../../../misc";
+import { getUserName, maybe } from "../../../misc";
import { UserError } from "../../../types";
import { CustomerDetails_user } from "../../types/CustomerDetails";
import CustomerAddresses from "../CustomerAddresses/CustomerAddresses";
@@ -78,10 +78,7 @@ const CustomerDetailsPage = withStyles(styles, { name: "CustomerDetailsPage" })(
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader
- onBack={onBack}
- title={maybe(() => `${customer.firstName} ${customer.lastName}`)}
- />
+ <PageHeader onBack={onBack} title={getUserName(customer, true)} />
<div className={classes.root}>
<div>
<CustomerDetails
diff --git a/saleor/static/dashboard-next/misc.ts b/saleor/static/dashboard-next/misc.ts
index f93bc968fd..3bfca1251d 100644
--- a/saleor/static/dashboard-next/misc.ts
+++ b/saleor/static/dashboard-next/misc.ts
@@ -177,10 +177,12 @@ interface User {
lastName?: string;
}
-export function getUserName(user?: User) {
+export function getUserName(user?: User, returnEmail?: boolean) {
return user && (user.email || (user.firstName && user.lastName))
? user.firstName && user.lastName
? [user.firstName, user.lastName].join(" ")
+ : returnEmail
+ ? user.email
: user.email.split("@")[0]
: null;
}