fix: stop showing a delegate's server id under Unknown person

This commit is contained in:
Linus Rath
2026-10-31 14:23:19 +01:00
parent 423e2780d5
commit b803da5df5
2 changed files with 9 additions and 4 deletions
+2 -4
View File
@@ -27,7 +27,7 @@ import {
summarizeDelegates, summarizeDelegates,
type DelegateSummary, type DelegateSummary,
} from '../../lib/delegation/delegation'; } from '../../lib/delegation/delegation';
import { describeSummary, principalDisplay, resolvePrincipal } from '../../lib/delegation/display'; import { describeSummary, principalDisplay, principalRowDisplay, resolvePrincipal } from '../../lib/delegation/display';
import { import {
pruneRememberedPrincipals, pruneRememberedPrincipals,
rememberPrincipals, rememberPrincipals,
@@ -223,9 +223,7 @@ export function DelegateSettings() {
<View style={styles.list}> <View style={styles.list}>
{summaries.map((summary, index) => { {summaries.map((summary, index) => {
const principal = principalFor(summary.principalId); const principal = principalFor(summary.principalId);
const display = principal const display = principalRowDisplay(principal, t);
? principalDisplay(principal)
: { name: t('delegates.unknown_person', 'Unknown person'), detail: summary.principalId };
const busy = removingId === summary.principalId; const busy = removingId === summary.principalId;
return ( return (
<View key={summary.principalId} style={[styles.row, index > 0 && styles.rowBorder]}> <View key={summary.principalId} style={[styles.row, index > 0 && styles.rowBorder]}>
@@ -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' }); 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', () => { 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 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); const label = sheet.slice(sheet.indexOf('const renderPrincipalLabel'), sheet.indexOf('return (', sheet.indexOf('const renderPrincipalLabel')) + 900);