Skip to content

#1950: a collapsed account shows its unread mail in the folder pane - #1989

Open
Mcm190 wants to merge 1 commit into
UCSLabs:mainfrom
Mcm190:fix/1950-folded-account-unread
Open

Mcm190 wants to merge 1 commit into
UCSLabs:mainfrom
Mcm190:fix/1950-folded-account-unread

Conversation

@Mcm190

@Mcm190 Mcm190 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1950

What changes for the person using MailCraft

A collapsed account in the folder pane now shows its unread mail beside its name, so one look at the pane tells which accounts have new mail, without expanding each one.

  • The count is the unread mail that the account's folder rows would show, added up: the Inbox, Archive and the owner's own folders. Junk Email, Drafts, the Outbox, Sent Items and Deleted Items aren't included, because their rows don't show an unread count either.
  • It shows nothing at zero and nothing while the account is expanded, so the number never appears twice (as the issue suggests).
  • A collapsed All Accounts shows the unread mail of its rows for every account together, which is the optional total the issue asks for.
  • It uses the same pill as a folder's count, on the heading's line and flush right. A long account name is cut short before it.
  • A screen reader hears it with the name ("Work, 2 unread"). Headings now also report whether they are expanded; before this they had no accessible label at all.

The counts come from the per-folder counts that are already cached once per mailbox change (Session::folder_counts). Each frame adds one pass over the folders and nothing else.

Light: All Accounts and the accounts collapsed Dark: the accounts collapsed, All Accounts open
Folder pane, light theme: All Accounts 6, avery@lumen.example 4, Work 2, Club with no count Folder pane, dark theme: avery@lumen.example 4, Work 2, Club with no count, under an open All Accounts

The screenshots show the sample mailbox and two invented accounts (Work, with 2 unread, and Club, with none), rendered with crates/ui-egui/examples/ui_shot.rs.

How it was checked

  • New tests in crates/ui-egui/src/nav_tests.rs:

    • a_folded_account_shows_its_unread_mail: the Inbox and a subfolder are counted, Junk Email and Sent Items are not. The count disappears when everything is read and when the account is expanded again, and the accessible label carries it.
    • folded_all_accounts_shows_every_accounts_unread_mail
    • unread_by_account_counts_what_the_rows_show_unread
  • account_setup::tests::help::the_waiting_page_says_what_to_do_about_an_approval_without_waiting checks that nothing on screen says "Favorites" while the sign-in page is open. The folder pane's own Favorites heading behind the dialog now has a label, so the check now skips a label that is exactly "Favorites" and still fails on any other mention.

  • cargo xtask ci: fmt, assets, spdx, test-files, workflows, layers, wasm-clock, i18n, release-notes, docs-log, clippy, wasm and deny all pass. All tests pass except opening_kind_tests::the_known_types_cover_what_this_desktop_says (engine). That test reads this machine's /usr/share/mime/globs2, and Fedora's copy lists a KDE type (*.tar.p7m) that the engine's list doesn't have. It has nothing to do with this change.

  • I looked at the result in light and dark (screenshots above).

  • Docs: the Folder pane row of docs/ui-parity.md with its revision fragment, a progress-log fragment and a release-notes fragment (new/1950.md).

  • cargo xtask ci passes

  • A crash or data-loss fix has its regression test

  • "Allow edits by maintainers" is ticked (the box beside Create pull request)

  • I have signed the CLA, or will by commenting on this pull request

Human-reviewed, AI-assisted, nobody's mailbox harmed.

Summary by CodeRabbit

  • New Features
    • Collapsed account headings now show a total unread count based on eligible folders. The collapsed All Accounts heading combines unread counts across accounts.
    • Counts are hidden when a heading is expanded or has no unread mail. Screen readers announce the count alongside the heading.
  • Documentation
    • Release notes clarify which folders contribute to the counts and when they appear.

… pane

A collapsed account's heading shows the unread count its folders' rows
would show, added up (Inbox, Archive, the owner's own folders; not Junk
Email, Drafts, the Outbox, Sent Items or Deleted Items), flush right in
the same pill as a folder's count. Nothing at zero or while the account
is open. A collapsed All Accounts shows its rows' unread together.

Headings now carry an accessible label (with the count when folded) and
their expanded state. The account-setup help test's check that the
sign-in page says nothing of Favorites skips the folder pane's own
Favorites heading, which is now read out.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@Mcm190
Mcm190 requested a review from benandez as a code owner November 26, 2026 14:41
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The folder pane now shows unread-count badges on folded account and All Accounts headings. Counts use eligible folder rows, remain hidden at zero and while headings are open, and are included in heading accessibility information. Tests and release notes cover the behavior.

Changes: Folder pane unread counts

Layer / File(s) Summary
Calculate folded heading counts
crates/ui-egui/src/nav.rs, crates/ui-egui/src/nav_tests.rs
The folder pane totals unread counts from eligible folder rows for folded accounts and All Accounts. The aggregation tests cover account filtering, folder kinds, and zero and positive totals.
Display and validate heading counts
crates/ui-egui/src/nav.rs, crates/ui-egui/src/nav_tests.rs, crates/ui-egui/src/account_setup/tests/help.rs, packaging/release-notes.d/new/1950.md
Folded headings display count pills and expose unread totals and expanded state to accessibility tools. UI tests check account and All Accounts badges. The waiting-page test excludes the Favorites heading from its check, and the release note describes the counts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant FolderPane
  participant CountOf
  participant Heading
  FolderPane->>CountOf: Evaluate folder-row count
  CountOf-->>FolderPane: Return unread classification
  FolderPane->>Heading: Pass folded unread total
  Heading-->>FolderPane: Render count and accessibility state
Loading

Suggested reviewers: kartas39

Merge Risk: Minimal · up to db7fc · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a collapsed account in the folder pane shows its unread mail count. It also cites the issue number #1950. It matches the changeset, which adds unread-count badges to c…
Description check Passed The description follows the repository template. It has the closing reference (Closes #1950), a 'What changes for the person using MailCraft' section that describes the behaviour and exclusions in det…
Linked Issues check Passed Direct issue #1950 asks for an unread count on collapsed account rows, hidden at zero, hidden while expanded, with an optional all-accounts total. The reviewed summary of crates/ui-egui/src/nav.rs sho…
Out of Scope Changes check Passed All changed files relate to the issue or support it. nav.rs and nav_tests.rs implement and test the badges and the accessible heading labels. packaging/release-notes.d/new/1950.md is a release note fo…
Full details: Title check

Explanation

The title names the main change: a collapsed account in the folder pane shows its unread mail count. It also cites the issue number #1950. It matches the changeset, which adds unread-count badges to collapsed account headings and All Accounts, and the PR objectives state the same goal.

Full details: Description check

Explanation

The description follows the repository template. It has the closing reference (Closes #1950), a 'What changes for the person using MailCraft' section that describes the behaviour and exclusions in detail, and a 'How it was checked' section listing tests, the CI result, the visual check, and docs/release-notes updates. Checklist items are included. The 'A crash or data-loss fix has its regression test' item is unchecked, which fits because this is not a crash or data-loss fix. The description does not have the optional 'Builds on' line, which is not needed here. The one gap is that the CI result reports a failing engine test (opening_kind_tests) that the author attributes to the local environment. The description states this clearly, so the template requirements are met.

Full details: Linked Issues check

Explanation

Direct issue #1950 asks for an unread count on collapsed account rows, hidden at zero, hidden while expanded, with an optional all-accounts total. The reviewed summary of crates/ui-egui/src/nav.rs shows: folded account headings sum unread counts from eligible folder rows via Count::of; open headings show no count; folded All Accounts shows the summed unread counts of its visible unified rows; zero maps to no count. crates/ui-egui/src/nav_tests.rs adds tests for these cases (a_folded_account_shows_its_unread_mail, folded_all_accounts_shows_every_accounts_unread_mail, unread_by_account_counts_what_the_rows_show_unread). Headings also expose folded state and unread totals to screen readers. The exclusion of Junk Email, Drafts, Outbox, Sent Items and Deleted Items is a design choice. The issue does not specify folder membership, and the PR ties the count to the rows that already show unread counts. Related issue #1445 is closed and is background only. Evidence came from the PR description and change summary, not from direct source reads. Source inspection was not available in this assessment, so the verdict rests on that summary.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the issue or support it. nav.rs and nav_tests.rs implement and test the badges and the accessible heading labels. packaging/release-notes.d/new/1950.md is a release note for the feature. The change to crates/ui-egui/src/account_setup/tests/help.rs narrows the 'Favorites' absence check to skip a label that is exactly 'Favorites'. The stated reason is that the folder pane's own Favorites heading now has an accessible label, which would otherwise trip the check. The check still fails on any other mention and still checks the Microsoft sign-in instruction. This is a narrow, explained adjustment. Docs changes (docs/ui-parity.md and log fragments) are documentation for this change. The engine test failure (opening_kind_tests) is reported as pre-existing and environment-specific, and the PR does not modify it. Source inspection was not available, so this verdict rests on the change summary and PR description.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 55a0043 and db7fc1a.

Files ignored due to path filters: 3

  • docs/log.d/ROADMAP/progress/1950.md is excluded by !docs/**
  • docs/log.d/docs/ui-parity/revisions/1950.md is excluded by !docs/**
  • docs/ui-parity.md is excluded by !docs/**
Files selected for processing: 4

  • crates/ui-egui/src/account_setup/tests/help.rs
  • crates/ui-egui/src/nav.rs
  • crates/ui-egui/src/nav_tests.rs
  • packaging/release-notes.d/new/1950.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

Folder pane: show an unread count next to a collapsed account

1 participant