fix: choose the reply From by an address the original names only in Bcc #87

This commit is contained in:
Linus Rath
2026-10-29 02:50:16 +01:00
parent 388f46b5b9
commit e47c05c58a
2 changed files with 24 additions and 1 deletions
+20 -1
View File
@@ -1,6 +1,7 @@
import { describe, it, expect } from 'vitest';
import type { Email } from '../../api/types';
import type { Email, Identity } from '../../api/types';
import { replyComposeParams } from '../reply-compose';
import { resolveReplyIdentity } from '../reply-identity';
const source = {
id: 'm1',
@@ -26,6 +27,24 @@ describe('replyComposeParams', () => {
expect(replyComposeParams('reply', source)?.prefillBody).toBeUndefined();
expect(replyComposeParams('reply', source, undefined, ' ')?.prefillBody).toBeUndefined();
});
it('lets the reply From match an address the message names only in Bcc (native #87)', () => {
const viaBcc = {
...source,
to: [{ name: 'owner/repo', email: 'repo@noreply.github.com' }],
bcc: [{ email: 'github@example.com' }],
} as Email;
const params = replyComposeParams('reply', viaBcc);
expect(params?.replyTo?.bcc).toEqual([{ email: 'github@example.com' }]);
const identities = [
{ id: 'main', name: 'Me', email: 'me@example.com', mayDelete: false },
] as Identity[];
const resolved = resolveReplyIdentity(identities, params!.replyTo!, {
ownEmails: ['me@example.com'], catchAll: true, matchMode: 'domain',
});
expect(resolved?.identityId).toBe('main');
expect(resolved?.overrideEmail).toBe('github@example.com');
});
});
describe('replyComposeParams: quoted inline images', () => {
+4
View File
@@ -49,6 +49,10 @@ export function replyComposeParams(
from: from ?? { email: '' },
to: source.to,
cc: source.cc,
// Never a recipient of the reply, but the composer picks the identity
// (and the catch-all From) by the address the message was delivered
// to, and a Sieve rule or a list may name that one only in Bcc.
bcc: source.bcc,
// RFC 5322: a reply goes to Reply-To when the sender set one.
replyToAddresses: source.replyTo,
subject: source.subject ?? '',