diff --git a/src/renderer/src/components/settings/cloud-api/CloudApiKeysSections.tsx b/src/renderer/src/components/settings/cloud-api/CloudApiKeysSections.tsx
index c217e1546be..9e4060a6536 100644
--- a/src/renderer/src/components/settings/cloud-api/CloudApiKeysSections.tsx
+++ b/src/renderer/src/components/settings/cloud-api/CloudApiKeysSections.tsx
@@ -274,7 +274,7 @@ function ActorLabel({
return mine ? (
<>{sentence}>
) : (
-
+
)
}
diff --git a/src/renderer/src/components/settings/cloud-api/PersonName.test.tsx b/src/renderer/src/components/settings/cloud-api/PersonName.test.tsx
new file mode 100644
index 00000000000..08c92d0b5e3
--- /dev/null
+++ b/src/renderer/src/components/settings/cloud-api/PersonName.test.tsx
@@ -0,0 +1,26 @@
+// @vitest-environment happy-dom
+import { cleanup, render } from '@testing-library/react'
+import { afterEach, expect, it } from 'vitest'
+import { PersonName, PersonSentence } from './PersonName'
+
+afterEach(cleanup)
+
+it('shows the display name only, never the raw id inline', () => {
+ const { container } = render()
+ expect(container.textContent).toBe('Grace Hopper')
+ expect(container.querySelector('[title]')).toBeNull()
+})
+
+it('says "Former member" when nobody can name the person', () => {
+ const { container } = render()
+ expect(container.textContent).toBe('Former member')
+ expect(container.innerHTML).not.toContain('u_7f3k')
+})
+
+it('keeps the id one hover away in the audit log only', () => {
+ const { container } = render(
+
+ )
+ expect(container.textContent).toBe('Former member via API key')
+ expect(container.querySelector('[title]')?.getAttribute('title')).toBe('u_7f3k')
+})
diff --git a/src/renderer/src/components/settings/cloud-api/PersonName.tsx b/src/renderer/src/components/settings/cloud-api/PersonName.tsx
index 68750ee0fff..f777d2957c1 100644
--- a/src/renderer/src/components/settings/cloud-api/PersonName.tsx
+++ b/src/renderer/src/components/settings/cloud-api/PersonName.tsx
@@ -1,32 +1,43 @@
import { Trans } from 'react-i18next'
-import { i18n } from '@/i18n/i18n'
+import { i18n, translate } from '@/i18n/i18n'
+import { useAppStore } from '@/store'
+import { useOrgRoster } from '../../billing/team/use-org-roster'
+
+/** The name the control plane sent, else the team roster's (the directory Home uses), else null. */
+function useMemberName(name: string | null | undefined, id: string): string | null {
+ const orgId = useAppStore((s) => s.orcaProfileAuthStatus?.cloud?.activeOrgId ?? null)
+ const known = name?.trim() || null
+ // Only read the shared roster when the server could not name this person.
+ const roster = useOrgRoster(known ? null : orgId)
+ if (known) {
+ return known
+ }
+ if (roster.result?.status === 'ok') {
+ const member = roster.result.roster.members.find((m) => m.userId === id)
+ return member?.displayName?.trim() || member?.email || null
+ }
+ return null
+}
/**
- * A teammate as the control plane knows them: "Ada Lovelace · u_ada" (name, then the id as
- * secondary text), or the id alone when no name is known. Never a vague "a teammate".
+ * A teammate as a display name only, never a raw id inline; "Former member" when nobody can
+ * name them. `idInTooltip` (audit log only) keeps the id one hover away for admins investigating.
*/
export function PersonName({
name,
- id
+ id,
+ idInTooltip = false
}: {
name: string | null | undefined
id: string
+ idInTooltip?: boolean
}): React.JSX.Element {
- const display = name?.trim()
- if (!display) {
- return (
-
- {id}
-
- )
- }
+ const display =
+ useMemberName(name, id) ??
+ translate('auto.components.settings.cloudApi.formerMember', 'Former member')
return (
-
- {display}
-
- {' · '}
- {id}
-
+
+ {display}
)
}
@@ -38,17 +49,19 @@ export function PersonName({
export function PersonSentence({
sentence,
name,
- id
+ id,
+ idInTooltip
}: {
sentence: string
name: string | null | undefined
id: string
+ idInTooltip?: boolean
}): React.JSX.Element {
return (
}}
+ components={{ person: }}
/>
)
}
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 4e6be059af3..824a19f310a 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -14405,6 +14405,7 @@
"description_other": "Starts waking a sleeping sandbox when you point at its workspace or come back to Orca, so it's ready sooner. If you don't open it, it goes back to sleep after {{count}} minutes idle. Early wakes count toward your sandbox hours."
},
"cloudApi": {
+ "formerMember": "Former member",
"keys": {
"createdMine": "Created {{time}}",
"createdByPerson": "Created by {{time}}",