From 4def80214c2cbcdcb55c41e57edd1100ec34c15f Mon Sep 17 00:00:00 2001 From: Sabrina Demagny Date: Fri, 10 Jan 2025 16:41:03 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20display=20email=20if=20no?= =?UTF-8?q?=20username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fallback to email if no username is defined for logged user. --- CHANGELOG.md | 1 + src/frontend/apps/desk/src/features/header/AccountDropdown.tsx | 2 +- .../desk/src/features/header/__tests__/AccountDropdown.test.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e499b6..274877a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to ### Added +- ✨(frontend) display email if no username #562 - 🧑‍💻(oidc) add ability to pull registration ID (e.g. SIRET) from OIDC #577 ### Fixed diff --git a/src/frontend/apps/desk/src/features/header/AccountDropdown.tsx b/src/frontend/apps/desk/src/features/header/AccountDropdown.tsx index 276ac52..0e489dc 100644 --- a/src/frontend/apps/desk/src/features/header/AccountDropdown.tsx +++ b/src/frontend/apps/desk/src/features/header/AccountDropdown.tsx @@ -9,7 +9,7 @@ export const AccountDropdown = () => { const { t } = useTranslation(); const { userData, logout } = useAuthStore(); - const userName = userData?.name || t('No Username'); + const userName = userData?.name || userData?.email || t('No Username'); return ( { }); renderAccountDropdown(); - expect(screen.getByText('No Username')).toBeInTheDocument(); + expect(screen.getByText('test@example.com')).toBeInTheDocument(); }); it('opens the dropdown and shows logout button when clicked', async () => {