From 3dd44cf6245021a55fb775061ede1bf5ed6d3032 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 30 Jul 2025 13:46:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=9B=9E=E5=A4=8D=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/EmailActions.js | 9 ++++----- src/views/NewEmail.jsx | 14 ++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/actions/EmailActions.js b/src/actions/EmailActions.js index b51d33d..2f11be9 100644 --- a/src/actions/EmailActions.js +++ b/src/actions/EmailActions.js @@ -81,17 +81,16 @@ export const postResendEmailAction = async (body) => { const encodeEmailInfo = (info) => { const encodeQuote = (str = '') => str.replace(/"/g, ''); //.replace(//g,'>') - const CSsClean = encodeQuote(info.MAI_CS).includes(',') ? encodeQuote(info.MAI_CS).split(',') : encodeQuote(info.MAI_CS).split(';'); - const tosClean = (encodeQuote(info.MAI_To).includes(',') ? encodeQuote(info.MAI_To).split(',') : encodeQuote(info.MAI_To).split(';')).concat(CSsClean).filter(s => s); + const CSsClean = encodeQuote(info.MAI_CS.replace(';', ',')).split(','); + const tosClean = (encodeQuote(info.MAI_To.replace(';', ',')).split(',')).map(e => e.trim()).filter(s => s); const replyTo = info.MAI_Direction === 1 ? info.MAI_To : info.MAI_From; - const replyToAll = (tosClean.length > 1) ? - (info.MAI_Direction === 1 ? tosClean.join(',') : [...tosClean, info.MAI_From].join(',')) - : (info.MAI_Direction === 1 ? info.MAI_To : info.MAI_From) + const replyToAll = [].concat([info.MAI_From], tosClean); return { ...info, MAI_From: encodeQuote(info.MAI_From), MAI_To: encodeQuote(info.MAI_To), tos: [...new Set(tosClean)], + ccs: [...new Set(CSsClean)], replyToAll, replyTo, } diff --git a/src/views/NewEmail.jsx b/src/views/NewEmail.jsx index 0c00bc3..939cacd 100644 --- a/src/views/NewEmail.jsx +++ b/src/views/NewEmail.jsx @@ -230,10 +230,11 @@ const NewEmail = () => { } readyToInitialContent += generateQuoteContent(mailData, originalContentType) break - case 'replyall': + case 'replyall': { + const tosNotMe = quotedMailSenderObj ? (info?.replyToAll || []).filter(addr => addr.indexOf(quotedMailSenderObj) === -1).join(', ') : (info?.replyToAll || []).join(', '); _formValues = { from: quotedMailSenderObj, - to: info?.replyToAll || orderReceiver, + to: isEmpty(info?.replyToAll) ? orderReceiver : tosNotMe, cc: info?.MAI_CS || '', // bcc: quote.bcc || '', subject: `Re: ${info.MAI_Subject || ''}`, @@ -241,6 +242,7 @@ const NewEmail = () => { } readyToInitialContent += generateQuoteContent(mailData, originalContentType) break + } case 'forward': _formValues = { from: quotedMailSenderObj, @@ -641,7 +643,7 @@ const NewEmail = () => { - + {!showCc && ( @@ -658,13 +660,13 @@ const NewEmail = () => { - +