Skip to content

fix(tui): update folder unread counter - #1493

Merged
andrinoff merged 1 commit into
floatpane:masterfrom
youdie006:feat/folder-unread-counter
Jun 20, 2026
Merged

andrinoff merged 1 commit into
floatpane:masterfrom
youdie006:feat/folder-unread-counter

Conversation

@youdie006

Copy link
Copy Markdown
Contributor

What?

After deleting or archiving emails, the per-folder unread counter shown in the sidebar ((N)) now updates immediately. The four handlers (DeleteEmailMsg, ArchiveEmailMsg, BatchDeleteEmailsMsg, BatchArchiveEmailsMsg) decrement m.unread[folder] for each removed unread email via a new decrementFolderUnreadForRemoved helper that mirrors the existing read/unread path (DecrementUnreadCount + persist); undo re-increments it. Adds five tests.

Why?

The delete/archive handlers mutated the email stores but never touched m.unread, so the sidebar folder counter stayed stale until the next server fetch (#1404). (syncUnreadBadge only sets the macOS dock badge, so it did not address this.)

Closes #1404

The delete/archive handlers mutated the email stores but never touched the
per-folder unread map, so the sidebar folder counter stayed stale until the
next server fetch. Decrement it for each removed unread email (mirroring the
read/unread path) and re-increment on undo.

Closes floatpane#1404
@youdie006
youdie006 requested a review from a team as a code owner June 20, 2026 13:10
@floatpanebot floatpanebot added bug Something isn't working os/macos macOS-specific area/tui Terminal UI / view layer size/M Diff: 51–200 lines and removed area/tui Terminal UI / view layer labels Jun 20, 2026
@andrinoff andrinoff removed the os/macos macOS-specific label Jun 20, 2026
@andrinoff
andrinoff enabled auto-merge June 20, 2026 19:24
@floatpanebot floatpanebot added the backport/v1 Merge to master and backport to release/v1 label Jun 20, 2026
@andrinoff
andrinoff added this pull request to the merge queue Jun 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 20, 2026
@andrinoff
andrinoff added this pull request to the merge queue Jun 20, 2026
Merged via the queue into floatpane:master with commit d093013 Jun 20, 2026
31 checks passed
@floatpanebot floatpanebot added the backported Cherry-picked onto release/v1 label Jun 20, 2026
floatpanebot pushed a commit that referenced this pull request Jun 20, 2026
## What?

After deleting or archiving emails, the per-folder unread counter shown
in the sidebar (`(N)`) now updates immediately. The four handlers
(`DeleteEmailMsg`, `ArchiveEmailMsg`, `BatchDeleteEmailsMsg`,
`BatchArchiveEmailsMsg`) decrement `m.unread[folder]` for each removed
unread email via a new `decrementFolderUnreadForRemoved` helper that
mirrors the existing read/unread path (`DecrementUnreadCount` +
persist); undo re-increments it. Adds five tests.

## Why?

The delete/archive handlers mutated the email stores but never touched
`m.unread`, so the sidebar folder counter stayed stale until the next
server fetch (#1404). (`syncUnreadBadge` only sets the macOS dock badge,
so it did not address this.)

Closes #1404

(cherry picked from commit d093013)
@floatpane floatpane deleted a comment from andrinoff Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v1 Merge to master and backport to release/v1 backported Cherry-picked onto release/v1 bug Something isn't working size/M Diff: 51–200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: unread counters are not updated

3 participants