From 82537c17a6455ab20df796fd68e03ad3bcfc0e3d Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Thu, 8 Oct 2026 05:04:01 -0400 Subject: [PATCH] fix(auth): stop repeating a Desktop account's email as its name A Desktop host session carries no display name, so useCurrentUser used the email for both, and the account menu showed the same address twice. Leave the name unset, as for a Firebase account without one; the email still shows once. --- src/composables/auth/useCurrentUser.test.ts | 20 ++++++++++++++++++++ src/composables/auth/useCurrentUser.ts | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/composables/auth/useCurrentUser.test.ts b/src/composables/auth/useCurrentUser.test.ts index b9f0f1c4bc8..12cfbdd6dd5 100644 --- a/src/composables/auth/useCurrentUser.test.ts +++ b/src/composables/auth/useCurrentUser.test.ts @@ -80,6 +80,26 @@ describe('useCurrentUser', () => { expect(resolvedUserInfo.value).toEqual({ id: 'host-user' }) }) + it('shows a Desktop host account by its email, without repeating it as the name', async () => { + const signedIn = { + status: 'signed_in', + userId: 'host-user', + email: 'sso@example.com' + } as const + await startDesktopHostSession({ + getState: async () => signedIn, + getWorkspaceToken: async () => 'host-token', + requestSignIn: async () => signedIn, + signOut: async () => ({ status: 'signed_out' }), + onChanged: () => () => {} + }) + + const { userDisplayName, userEmail } = useCurrentUser() + + expect(userEmail.value).toBe('sso@example.com') + expect(userDisplayName.value).toBeUndefined() + }) + it('reads a Firebase-only login entirely from Firebase', () => { mockAuthState.currentUser = fromPartial< NonNullable diff --git a/src/composables/auth/useCurrentUser.ts b/src/composables/auth/useCurrentUser.ts index 4f9a138d540..542a658932d 100644 --- a/src/composables/auth/useCurrentUser.ts +++ b/src/composables/auth/useCurrentUser.ts @@ -57,7 +57,7 @@ export const useCurrentUser = () => { } const userDisplayName = computed(() => { - if (desktopHostUser.value) return desktopHostUser.value.email + if (desktopHostUser.value) return undefined if (isApiKeyLogin.value) { return apiKeyStore.currentUser?.name }