fix(email): route bin/trash action through IMAP delete instead of labels - #430
Open
santhiprakash wants to merge 1 commit into
Open
fix(email): route bin/trash action through IMAP delete instead of labels#430santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
The trash icon and "Move to Bin" flow was calling mail.modifyLabels, which only adds/removes IMAP keywords. On real-mailbox servers like Dovecot, this leaves the message in INBOX with a visible TRASH tag instead of moving it to Trash. Use the existing trpc.mail.bulkDelete path (deleteThreads) which does messageMove(..., 'Trash') when the source is not Trash and permanently deletes when it is. Pass the source folder along in the two delete entry points so the IMAP driver looks in the right mailbox. Fixes oblien#429
santhiprakash
force-pushed
the
fix/email-bin-imap-move-429
branch
from
August 5, 2026 02:36
c8f0c52 to
e5e095b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The webmail trash/bin action was only applying a Gmail-style
TRASHlabel throughmail.modifyLabels. On real-mailbox IMAP servers like Dovecot this leaves the message in INBOX with a visibleTRASHtag instead of moving it to the Trash mailbox.Motivation
Issue #429 reports two things. This PR addresses the deleted-email/TRASH-label bug. The server already has the correct
deleteThreadspath (messageMove(..., 'Trash')ormessageDeletewhen already in Trash), but the client was not calling it from the bin flow.Related issue
Addresses the deleted/TRASH-label bug described in #429. The auto-refresh feature request in the same issue is a separate piece of work and is not addressed here.
Changes
apps/email/client/lib/thread-actions.ts:moveThreadsTocase 'bin'now callstrpcClient.mail.bulkDelete.mutate({ ids, folder }), which routes todeleteThreadson the server.apps/email/client/hooks/use-optimistic-actions.ts:optimisticDeleteThreadsnow passesfolder: currentFoldertobulkDeleteThreadso the IMAP driver looks in the correct source mailbox.apps/email/client/components/context/thread-context.tsx: the bin "Delete permanently" action now passesfolder: currentFoldertodeleteThreadso it targets the Trash mailbox instead of defaulting to INBOX.Verification
bun run --cwd apps/email/client lintcould not be run because the workspace'seslint.config.tsimports a missing@zero/eslint-configpackage.bun run testat the root has pre-existing environment-specific timeouts inapps/cliandpackages/dbunrelated to this change; the CI Test check passed.bunx prettier --checkon the three changed files shows many pre-existing formatting issues outside this diff, so I left the files in their existing local style and changed only the functional lines to keep the diff scoped.apps/email/clientworkspace does not have a test script, so the behavior was verified by reading thetrpc.mail.bulkDelete/trpc.mail.deleteroute definitions and thedeleteThreadsdriver implementation.Screenshots
Not applicable — behavior change is in the IMAP driver call, not the UI chrome.
Checklist
bun run test,bun run --cwd <workspace> lint, andbun formatall pass locally