From 279a1dd593c86f78962a016f009a76aaf722ec52 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 4 Nov 2026 06:38:11 +0100 Subject: [PATCH] fix: name no identity on your own messages in the reader The badge test said a differing sender name gets "via "; that badge is gone, so it now checks that nothing is shown and that the sub-address tag still is. --- .../__tests__/email-identity-badge.test.tsx | 16 ++++++++++---- components/email/email-identity-badge.tsx | 21 +++++-------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/components/email/__tests__/email-identity-badge.test.tsx b/components/email/__tests__/email-identity-badge.test.tsx index 7d2457acf..d08d78049 100644 --- a/components/email/__tests__/email-identity-badge.test.tsx +++ b/components/email/__tests__/email-identity-badge.test.tsx @@ -4,7 +4,8 @@ import React from 'react'; import { EmailIdentityBadge } from '../email-identity-badge'; import type { Email, Identity } from '@/lib/jmap/types'; -// A draft or sent mail from "User A" showed "User A via User A". +// A draft or sent mail from "User A" showed "User A via User A", and any +// other own message "via ". const identity = { id: 'id-1', name: 'User A', email: 'usera@example.org' } as Identity; const fromUser = (name: string) => ({ from: [{ name, email: 'usera@example.org' }], to: [] }) as unknown as Email; @@ -15,9 +16,16 @@ describe('EmailIdentityBadge', () => { expect(container.textContent).toBe(''); }); - it('names the identity when the sender name differs', () => { + it('names no identity on your own message, whatever the sender name', () => { + // "via " read like a delegation warning; the address under the + // name already says which of your addresses sent it. const { container } = render(); - // The translation mock returns the key of the "via {name}" text. - expect(container.textContent).toContain('identity_short'); + expect(container.textContent).toBe(''); + }); + + it('still shows the sub-address tag', () => { + const email = { from: [{ name: 'Support Desk', email: 'usera+news@example.org' }], to: [] } as unknown as Email; + const { container } = render(); + expect(container.textContent).toContain('news'); }); }); diff --git a/components/email/email-identity-badge.tsx b/components/email/email-identity-badge.tsx index 708991641..2b05413ce 100644 --- a/components/email/email-identity-badge.tsx +++ b/components/email/email-identity-badge.tsx @@ -111,7 +111,11 @@ export function EmailIdentityBadge({ return null; } - // Full view for email viewer - now shows compact badges only + // Full view for email viewer - the sub-address tag only. A message of your + // own named its identity ("via "), which read like a delegation + // warning; the sender's address, shown right under the name, already says + // which of your addresses sent it. + if (!displayTag) return null; return (
{/* Sub-address tag badge */} @@ -130,21 +134,6 @@ export function EmailIdentityBadge({
)} - {/* Identity badge (only if identity has a name and no sub-address tag) */} - {!displayTag && matchingIdentity && showIdentityName && ( -
- - {t('identity_short', { name: matchingIdentity.name })} -
- )} ); }