Skip to content

fix(search): scope the unread quick-filter to the current folder - #880

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/unread-filter-folder-scope
Open

fix(search): scope the unread quick-filter to the current folder#880
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:fix/unread-filter-folder-scope

Conversation

@shukiv

@shukiv shukiv commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Bug

Clicking a folder's unread count (e.g. Inbox: 29) opens a list that includes unread mail from every folder — Trash, Spam, etc. — contradicting the folder-local badge that was clicked.

Cause

handleUnreadFilterClick enables the unread filter and calls advancedSearch, but never sets searchMailboxId. It stays "", so buildJMAPFilter adds no inMailbox constraint and the search spans all mailboxes.

Fix

Set searchMailboxId to the clicked mailbox when enabling the filter (clear it when toggling off), so the unread view is scoped to that folder and matches the count. One file, components/mail/mail-app.tsx.

Testing

  • In Inbox, click the unread badge → list now shows only Inbox unread (previously pulled Trash/Spam unread too).
  • Toggle off → back to full folder view.
  • tsc --noEmit clean.

Clicking a folder's unread count (e.g. Inbox: 29) enabled the unread
filter and ran advancedSearch with no folder scope, so searchMailboxId
stayed "" and buildJMAPFilter added no inMailbox constraint — the result
listed unread mail from every folder, including Trash and Spam, which
contradicts the folder-local badge the user clicked.

Set searchMailboxId to the clicked mailbox when enabling the filter (and
clear it when toggling off) so the unread view matches the count.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant