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