mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 17:55:26 -04:00
fix: reply-all Cc's the user's own other addresses (multi-account) (#672)
* feat: publish all configured email addresses for reply-all exclusion * fix: exclude all of the user's own addresses from reply-all, not just the active one * test: reply-all excludes all of the user's configured addresses
This commit is contained in:
@@ -12,14 +12,16 @@ export function extractEmail(addr) {
|
||||
// Reply-all CC = everyone on the original To + Cc, minus ourselves, with the
|
||||
// original "Name <email>" form preserved.
|
||||
//
|
||||
// `myAddress` empty/unknown ⇒ no exclusion. Comparing by exact extracted email
|
||||
// (not a substring `includes`) is what fixes issue #360: an empty self address
|
||||
// made `"...".includes("")` true for every recipient, so reply-all dropped the
|
||||
// entire Cc list and kept only the original sender.
|
||||
export function buildReplyAllCc(data, myAddress) {
|
||||
const me = (myAddress || '').toLowerCase();
|
||||
// `mine` is a single address or a list of the user's own addresses (a
|
||||
// multi-account user has more than one). Empty/unknown ⇒ no exclusion.
|
||||
// Comparing by exact extracted email (not a substring `includes`) is what
|
||||
// fixes issue #360: an empty self address made `"...".includes("")` true for
|
||||
// every recipient, so reply-all dropped the entire Cc list.
|
||||
export function buildReplyAllCc(data, mine) {
|
||||
const list = Array.isArray(mine) ? mine : [mine];
|
||||
const me = new Set(list.map((a) => (a || '').toLowerCase()).filter(Boolean));
|
||||
const split = (s) => (s || '').split(',').map((x) => x.trim()).filter(Boolean);
|
||||
return [...split(data && data.to), ...split(data && data.cc)]
|
||||
.filter((addr) => !me || extractEmail(addr) !== me)
|
||||
.filter((addr) => !me.has(extractEmail(addr)))
|
||||
.join(', ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user