Neah version mail forward fix 2

This commit is contained in:
alma 2025-04-16 20:03:24 +02:00
parent a159e7d99a
commit 8dd78f4bfb

View File

@ -1305,14 +1305,31 @@ export default function MailPage() {
case 'reply': case 'reply':
return selectedEmail.from; return selectedEmail.from;
case 'replyAll': case 'replyAll':
// Combine from and cc, excluding current user's email // For Reply All, only put the original sender in To
const addresses = new Set([selectedEmail.from, ...(selectedEmail.cc?.split(',') || [])]); return selectedEmail.from;
return Array.from(addresses).filter(addr => addr !== accounts[1]?.email).join(', ');
case 'forward': case 'forward':
return ''; return '';
} }
}; };
const getReplyCc = () => {
if (type === 'replyAll') {
// For Reply All, put all other recipients in CC, excluding the sender and current user
const allRecipients = new Set([
...(selectedEmail.to?.split(',') || []),
...(selectedEmail.cc?.split(',') || [])
]);
// Remove the sender and current user from CC
allRecipients.delete(selectedEmail.from);
allRecipients.delete(accounts[1]?.email);
return Array.from(allRecipients)
.map(email => email.trim())
.filter(email => email) // Remove empty strings
.join(', ');
}
return '';
};
const getReplyBody = () => { const getReplyBody = () => {
try { try {
const parsed = parseFullEmail(selectedEmail.body); const parsed = parseFullEmail(selectedEmail.body);
@ -1330,7 +1347,7 @@ export default function MailPage() {
.replace(/<p[^>]*>/gi, '\n') .replace(/<p[^>]*>/gi, '\n')
.replace(/<\/p>/gi, '') .replace(/<\/p>/gi, '')
.replace(/<[^>]+>/g, '') .replace(/<[^>]+>/g, '')
.replace(/&nbsp;|&zwnj;|&raquo;|&laquo;|&gt;|&lt;|&amp;/g, match => { .replace(/&nbsp;|&zwnj;|&raquo;|&laquo;|&gt;/g, match => {
switch (match) { switch (match) {
case '&nbsp;': return ' '; case '&nbsp;': return ' ';
case '&zwnj;': return ''; case '&zwnj;': return '';
@ -1415,9 +1432,10 @@ export default function MailPage() {
setComposeTo(getReplyTo()); setComposeTo(getReplyTo());
setComposeSubject(getReplySubject()); setComposeSubject(getReplySubject());
setComposeBody(getReplyBody()); setComposeBody(getReplyBody());
setComposeCc(''); setComposeCc(getReplyCc());
setComposeBcc(''); setComposeBcc('');
setShowCc(false); // Show CC field automatically for Reply All
setShowCc(type === 'replyAll');
setShowBcc(false); setShowBcc(false);
setAttachments([]); setAttachments([]);
}; };