mirror of
https://github.com/bulwarkmail/native.git
synced 2026-10-31 16:06:32 +00:00
fix: choose the reply From by an address the original names only in Bcc #87
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
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 { replyComposeParams } from '../reply-compose';
|
||||||
|
import { resolveReplyIdentity } from '../reply-identity';
|
||||||
|
|
||||||
const source = {
|
const source = {
|
||||||
id: 'm1',
|
id: 'm1',
|
||||||
@@ -26,6 +27,24 @@ describe('replyComposeParams', () => {
|
|||||||
expect(replyComposeParams('reply', source)?.prefillBody).toBeUndefined();
|
expect(replyComposeParams('reply', source)?.prefillBody).toBeUndefined();
|
||||||
expect(replyComposeParams('reply', source, undefined, ' ')?.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', () => {
|
describe('replyComposeParams: quoted inline images', () => {
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ export function replyComposeParams(
|
|||||||
from: from ?? { email: '' },
|
from: from ?? { email: '' },
|
||||||
to: source.to,
|
to: source.to,
|
||||||
cc: source.cc,
|
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.
|
// RFC 5322: a reply goes to Reply-To when the sender set one.
|
||||||
replyToAddresses: source.replyTo,
|
replyToAddresses: source.replyTo,
|
||||||
subject: source.subject ?? '',
|
subject: source.subject ?? '',
|
||||||
|
|||||||
Reference in New Issue
Block a user