From 0efde2e61d744fa7e1dff791baa0369cd84d63d7 Mon Sep 17 00:00:00 2001 From: Linus Rath Date: Mon, 7 Sep 2026 22:34:47 +0200 Subject: [PATCH] fix: set the answered flag when the reply is sent with a delay #985 --- components/mail/mail-app.tsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/components/mail/mail-app.tsx b/components/mail/mail-app.tsx index 3502bd303..72dfed3d0 100644 --- a/components/mail/mail-app.tsx +++ b/components/mail/mail-app.tsx @@ -1696,15 +1696,12 @@ export function MailApp({ linkSegments }: MailAppProps = {}) { const toastInstance = (await import('sonner')).toast; toastInstance.warning(t('email_composer.send_filing_warning')); } - if (result.scheduled) { - await refreshScheduledMetadata(client); - if (isScheduledView) await fetchScheduledEmails(client); - return; - } - // Mark the original email with $answered or $forwarded keyword. Route the // write to the email's own account so the flag lands on shared/group-mailbox // messages instead of being dropped against the reaching account. (#281) + // This runs before the scheduled early-return: the undo-send delay is a + // HOLDFOR submission, so `scheduled` is true for every delayed send and + // the flag was never set. (#985) if (originalEmailId && (effectiveMode === 'reply' || effectiveMode === 'replyAll' || effectiveMode === 'forward')) { const keyword = effectiveMode === 'forward' ? '$forwarded' : '$answered'; try { @@ -1714,6 +1711,12 @@ export function MailApp({ linkSegments }: MailAppProps = {}) { } } + if (result.scheduled) { + await refreshScheduledMetadata(client); + if (isScheduledView) await fetchScheduledEmails(client); + return; + } + // Refresh the current mailbox to update the UI if (!isScheduledView) { await refreshCurrentMailbox(client); @@ -3126,14 +3129,10 @@ export function MailApp({ linkSegments }: MailAppProps = {}) { envelopeMailFrom, ); - if (result.scheduled) { - await refreshScheduledMetadata(client); - return; - } - // Mark the original email as answered. Route the write to the email's own // account so the flag lands on shared/group-mailbox messages instead of - // being dropped against the reaching account. (#281) + // being dropped against the reaching account. (#281) Runs before the + // scheduled early-return so a delayed (undo-send) reply is flagged too. (#985) { try { await useEmailStore.getState().markEmailKeyword(client, originalEmailId, '$answered'); @@ -3142,6 +3141,11 @@ export function MailApp({ linkSegments }: MailAppProps = {}) { } } + if (result.scheduled) { + await refreshScheduledMetadata(client); + return; + } + // Refresh emails to show the sent reply await refreshCurrentMailbox(client); // Re-fetch the replied thread's cross-folder data so the expanded