diff --git a/src/components/settings/DelegateSettings.tsx b/src/components/settings/DelegateSettings.tsx index e13a88d0..ffcab891 100644 --- a/src/components/settings/DelegateSettings.tsx +++ b/src/components/settings/DelegateSettings.tsx @@ -27,7 +27,7 @@ import { summarizeDelegates, type DelegateSummary, } from '../../lib/delegation/delegation'; -import { describeSummary, principalDisplay, resolvePrincipal } from '../../lib/delegation/display'; +import { describeSummary, principalDisplay, principalRowDisplay, resolvePrincipal } from '../../lib/delegation/display'; import { pruneRememberedPrincipals, rememberPrincipals, @@ -223,9 +223,7 @@ export function DelegateSettings() { {summaries.map((summary, index) => { const principal = principalFor(summary.principalId); - const display = principal - ? principalDisplay(principal) - : { name: t('delegates.unknown_person', 'Unknown person'), detail: summary.principalId }; + const display = principalRowDisplay(principal, t); const busy = removingId === summary.principalId; return ( 0 && styles.rowBorder]}> diff --git a/src/lib/delegation/__tests__/unknown-principal.test.ts b/src/lib/delegation/__tests__/unknown-principal.test.ts index 4159ce37..5dfb6f43 100644 --- a/src/lib/delegation/__tests__/unknown-principal.test.ts +++ b/src/lib/delegation/__tests__/unknown-principal.test.ts @@ -21,6 +21,13 @@ describe('someone with access the server does not name', () => { expect(principalRowDisplay(principal, tEn)).toEqual({ name: 'userb@example.org', detail: 'User B' }); }); + it('is the row the Delegates settings list shows', () => { + // On Stalwart 1.0.1 the row read "Unknown person" over "e". + const settings = fs.readFileSync(path.resolve(__dirname, '../../../components/settings/DelegateSettings.tsx'), 'utf8'); + expect(settings).toMatch(/const display = principalRowDisplay\(principal, t\);/); + expect(settings).not.toMatch(/detail: summary\.principalId/); + }); + it('gets no id for an address line in the calendar and address book share sheet', () => { const sheet = fs.readFileSync(path.resolve(__dirname, '../../../components/sharing/ShareCollectionSheet.tsx'), 'utf8'); const label = sheet.slice(sheet.indexOf('const renderPrincipalLabel'), sheet.indexOf('return (', sheet.indexOf('const renderPrincipalLabel')) + 900);