diff --git a/apps/email/client/hooks/use-threads.ts b/apps/email/client/hooks/use-threads.ts index 13e6037d3..2c8819c0b 100644 --- a/apps/email/client/hooks/use-threads.ts +++ b/apps/email/client/hooks/use-threads.ts @@ -35,9 +35,10 @@ export const useThreads = () => { // explicit refresh button). Without this, stale-while-revalidate // refetches were overwriting a just-marked row with the older // server snapshot and visibly "reverting" the action. - staleTime: Infinity, - refetchOnMount: false, - refetchOnWindowFocus: false, + staleTime: 10000, + refetchInterval: 30000, + refetchOnMount: true, + refetchOnWindowFocus: true, }, ), ); diff --git a/apps/email/server/src/lib/imap-driver.ts b/apps/email/server/src/lib/imap-driver.ts index 9ae123f46..25753e0a1 100644 --- a/apps/email/server/src/lib/imap-driver.ts +++ b/apps/email/server/src/lib/imap-driver.ts @@ -1304,7 +1304,15 @@ export async function modifyLabels( } if (!found) continue; if (input.addLabels && input.addLabels.length > 0) { - await client.messageFlagsAdd(found, input.addLabels, { uid: true }); + if (input.addLabels.includes('TRASH') || input.addLabels.includes('bin')) { + if (mailbox === 'Trash') { + await client.messageDelete(found, { uid: true }); + } else { + await client.messageMove(found, 'Trash', { uid: true }); + } + } else { + await client.messageFlagsAdd(found, input.addLabels, { uid: true }); + } } if (input.removeLabels && input.removeLabels.length > 0) { await client.messageFlagsRemove(found, input.removeLabels, { uid: true });