fix: set the answered flag when the reply is sent with a delay #985

This commit is contained in:
Linus Rath
2026-09-07 22:34:47 +02:00
parent 4afc2a5db0
commit 0efde2e61d
+16 -12
View File
@@ -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