Skip to content

Limit the number of notifications shown simultaneously#40

Merged
snipsnipsnip merged 5 commits intoexteditor:mainfrom
snipsnipsnip:limit-notification
Oct 16, 2025
Merged

Limit the number of notifications shown simultaneously#40
snipsnipsnip merged 5 commits intoexteditor:mainfrom
snipsnipsnip:limit-notification

Conversation

@snipsnipsnip
Copy link
Copy Markdown
Member

@snipsnipsnip snipsnipsnip commented Oct 16, 2025

In #24, I implemented notifications, but I’ve noticed that repeatedly hitting the toolbar buttons shows many number of notifications, while Thunderbird drops some of them. Limit the number of notifications so that they display smoothly.

* Make filename lowercase
* Move readme under `doc/` instead of the top page
* List modules in subdirectories
I tested the RTL language (Arabic), and noticed that the port number field,
which is LTR, looks odd. For now, we align numbers to the right regardless
of text direction and await feedback from users of RTL languages.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 16, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Style

    • Refined styling for number input fields to enhance visual consistency and usability throughout the application interface.
  • Bug Fixes

    • Improved notification handling system with optimized concurrent processing to ensure reliable, timely delivery of status alerts and critical updates without overwhelming the interface.

Walkthrough

The pull request consolidates test result reporting, refactors asynchronous email editor updates with status change detection, introduces a notification slot management system, updates CSS alignment handling, and modifies TypeDoc documentation configuration across the codebase.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/build.yml, .github/workflows/check-pr.yml
Updated Codecov test-results file path from glob pattern build/test/**/*.junit.xml to specific file build/test/result.junit.xml in both workflows
CSS Styling
ext/options.css, ext/options.nolint.css
Replaced CSS variable var(--align-end) with hardcoded right for number input alignment; added new CSS custom property --align-start mapped to __MSG_@@bidi_start_edge__
TypeScript Features
src/ghosttext-adaptor/email_editor.ts, src/thunderbird/background_util/notification_tray.ts
Made EmailEditor.update async with status change detection using lastStatus; introduced new NotificationTray class with concurrent slot management (slotCount=5) and ID generation via makeId()
TypeScript Configuration
tsconfig.json
Extended TypeDoc options with readme="none", excludePrivate=false, includeHierarchySummary=false, excludeReferences=true, modifierTags=["@file"], sluggerConfiguration, and new entry point ./src/*/*/index.ts

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant EmailEditor
    participant Promise.all
    participant NotifyModule
    participant IconModule
    participant Status

    Caller->>EmailEditor: update()
    activate EmailEditor
    EmailEditor->>Status: compare with lastStatus
    alt Status Changed
        EmailEditor->>Promise.all: concurrent operations
        activate Promise.all
        Promise.all->>NotifyModule: show notification
        Promise.all->>IconModule: update compose window icon
        activate NotifyModule
        activate IconModule
        NotifyModule-->>Promise.all: done
        IconModule-->>Promise.all: done
        deactivate NotifyModule
        deactivate IconModule
        deactivate Promise.all
    else Status Unchanged
        Note over EmailEditor: skip notification
    end
    EmailEditor->>Status: update lastStatus
    EmailEditor-->>Caller: Promise<void>
    deactivate EmailEditor
Loading
sequenceDiagram
    participant Client
    participant NotificationTray
    participant makeId
    participant SlotManager as Slot Manager<br/>(slotCount=5)

    Client->>NotificationTray: showNotification(options)
    activate NotificationTray
    NotificationTray->>makeId: generate ID
    activate makeId
    makeId->>SlotManager: cycle within 5 slots
    SlotManager-->>makeId: nextID
    makeId-->>NotificationTray: ID
    deactivate makeId
    NotificationTray->>NotificationTray: create notification<br/>with ID + options
    NotificationTray-->>Client: notification created
    deactivate NotificationTray
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

The changes are mostly straightforward: workflow config updates are procedural, CSS changes are minimal, TypeScript additions introduce clear async/await patterns and a straightforward slot-based ID management system with no complex business logic, and the TypeDoc config change is a declarative update.

Possibly related PRs

  • ci: install codecov #36: Modifies GitHub Actions workflows' Codecov integration step and test command; directly related to the workflow file path changes in this PR.
  • build: add codecov plugin to tsdown #37: Updates Codecov test-results workflow integration and test reporter output to match the expected build/test/**/*.junit.xml path; related to the narrowed test-results file path in this PR.

Poem

🐰 Notifications hop in slots of five,
Email updates now async-thrive,
Status changes dance with care,
Tests consolidated everywhere!
Styles align, the docs take flight—
All the pieces fit just right! 🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is completely absent and does not follow the repository’s required template, omitting the license agreement checkbox, change type selection, current and new behavior descriptions, testing steps, and any additional context. Please provide a description using the repository’s template by adding the dual-license agreement, selecting the change type, detailing the current and new behavior, listing manual test steps, and including any other relevant information.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the primary change of limiting concurrent notifications by introducing a slot count mechanism and aligns with the main objective of the pull request without extraneous details or noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 21.42857% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.43%. Comparing base (1feb7c1) to head (34d5bbb).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ghosttext-adaptor/email_editor.ts 0.00% 6 Missing ⚠️
...c/thunderbird/background_util/notification_tray.ts 37.50% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
- Coverage   48.47%   48.43%   -0.05%     
==========================================
  Files          55       55              
  Lines        2133     2141       +8     
  Branches      286      286              
==========================================
+ Hits         1034     1037       +3     
- Misses       1092     1097       +5     
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1feb7c1 and 34d5bbb.

📒 Files selected for processing (7)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/check-pr.yml (1 hunks)
  • ext/options.css (1 hunks)
  • ext/options.nolint.css (1 hunks)
  • src/ghosttext-adaptor/email_editor.ts (1 hunks)
  • src/thunderbird/background_util/notification_tray.ts (3 hunks)
  • tsconfig.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/ghosttext-adaptor/email_editor.ts (1)
src/ghosttext-runner/api.ts (1)
  • ClientStatus (109-109)
src/thunderbird/background_util/notification_tray.ts (1)
src/ghosttext-adaptor/api.ts (1)
  • INotificationTray (5-8)
🔇 Additional comments (6)
ext/options.nolint.css (1)

5-5: LGTM!

Adding --align-start provides proper bidirectional text support and complements the existing --align-end variable.

.github/workflows/check-pr.yml (1)

59-59: LGTM!

This change is consistent with .github/workflows/build.yml and consolidates test result reporting to a single file.

tsconfig.json (1)

34-45: LGTM!

The TypeDoc configuration updates improve documentation generation:

  • readme: "none" prevents default readme duplication
  • excludePrivate: false ensures comprehensive API documentation
  • The new entry point pattern ./src/*/*/index.ts captures additional module exports
  • Slug configuration ensures consistent URL formatting

Also applies to: 50-50

src/ghosttext-adaptor/email_editor.ts (1)

23-33: LGTM!

The refactor to async update with status change detection and concurrent updates is well-implemented:

  • isNewStatus correctly detects status changes before lastStatus is updated
  • Promise.all efficiently handles concurrent notification and icon updates
  • Notifications now only appear when status actually changes, aligning with the PR objective to limit notifications
src/thunderbird/background_util/notification_tray.ts (1)

9-11: LGTM!

The notification slot management correctly implements the PR objective:

  • slotCount = 5 limits simultaneous notifications
  • makeId() cycles notification IDs using modulo arithmetic (0→1→2→3→4→0...)
  • Reusing IDs replaces older notifications, preventing notification overload

Also applies to: 20-21, 34-37

.github/workflows/build.yml (1)

59-59: Test results path is correct
Vitest’s OUTPUT_DIR is set to build/test/ and the JUnit reporter writes result.junit.xml there, so build/test/result.junit.xml is valid.

@snipsnipsnip snipsnipsnip added this pull request to the merge queue Oct 16, 2025
Merged via the queue into exteditor:main with commit cf52c86 Oct 16, 2025
4 checks passed
@snipsnipsnip snipsnipsnip deleted the limit-notification branch October 16, 2025 08:53
@github-project-automation github-project-automation bot moved this from 📥️Inbox to 🪺Experimental in Ghostbird Issues Oct 16, 2025
@snipsnipsnip snipsnipsnip linked an issue Oct 29, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Feature] Connection indicator is too subtle

1 participant