Menu ▾ ▴

#378 feat(notifications): honor Messenger's own Do Not Disturb

closed
nobody
None
2026-11-07
2026-11-07
Anonymous
No

Originally created by: kristofferR

Turning on Do Not Disturb in Messenger (or on the phone) syncs to the account, but Carrier kept showing notifications because nothing read it.

Carrier now reads the account's notification_settings.globalMuteUntil from Messenger's local database (seconds since 1970 when it ends; 0 off; -1 until turned off) every 30 seconds, on window focus and at load. While it is active, notifications are treated exactly like Carrier's own Mute Notifications: one notificationsGloballyMuted check now covers construction, pending-receipt retirement and delivery, so nothing silenced during Do Not Disturb resurfaces afterwards. The unread badge keeps counting. A failed read keeps the last known state, and diagnostics note state changes.

Idea from fMess (MIT).

Manual check still needed: turn on Do Not Disturb from the phone for an hour; Carrier stays silent while the badge counts, and notifications return when it ends or is turned off. Carrier.log shows notify.messenger-dnd.

Ref [#353]

Summary by CodeRabbit

  • New Features
  • Messenger notifications are now suppressed while Messenger’s Do Not Disturb setting is active, alongside the existing notification mute controls.
  • Do Not Disturb status refreshes periodically and when the app window regains focus.
  • If the setting can’t be read, the last known status is preserved.
  • Documentation
  • Updated the README to note that Messenger’s Do Not Disturb setting is honored.

CodeRabbit reviews this change in the combined PR [#394].

Related

Tickets: #353
Tickets: #381
Tickets: #394

Discussion

  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review Summary: ✅ Completed This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-07T19:31:18.300509Z">2026-11-07T19:31:18.300509Z</relative-time> | `687f638` | Manual request |
    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
     
  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. Can't wait for the next one!

    Reviewed commit: 039ea3ec26

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
     
  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: coderabbitai[bot]

    Action performed

    Review finished. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: coderabbitai[bot]

    <picture>Explain Change →</picture>

    Walkthrough

    The Messenger injection now reads account-level `globalMuteUntil` state and refreshes it on startup, window focus, and a 30-second interval. Active Do Not Disturb joins existing global and conversation mute checks at notification creation and delivery. The README and bundled injection reflect the change. **Changes: Messenger Do Not Disturb** |Layer / File(s)|Summary| |:---|:---| |**Read and interpret Do Not Disturb state**
    `inject/src/messenger/lib/messenger-dnd.ts`, `inject/src/messenger/lib/messenger-dnd.test.ts`, `src-tauri/inject/messenger.js`|The new helpers parse mute-until values and read the signed-in account's settings. Tests cover active and expired timestamps, supported value formats, missing rows, and unavailable reads.| |**Refresh and register Do Not Disturb state**
    `inject/src/messenger/features/messenger-dnd.ts`, `inject/src/messenger/index.ts`, `src-tauri/inject/messenger.js`|The feature refreshes the account state after page load, on window focus, and every 30 seconds. The initializer is registered with existing feature error handling.| |**Apply Do Not Disturb to notification checks**
    `inject/src/messenger/lib/mute.ts`, `inject/src/messenger/features/notifications.ts`, `inject/src/messenger/lib/messenger-dnd.test.ts`, `src-tauri/inject/messenger.js`, `README.md`|Notification checks now combine the account's Do Not Disturb state with `mute_notifications`. Existing conversation mute handling remains. The README now states that Messenger Do Not Disturb is honored.| **Estimated code review effort:** 3 (Moderate) | ~20 minutes **Change:** Feature ### Sequence Diagram(s) :::mermaid sequenceDiagram participant MessengerFeature participant readMessengerDndUntil participant MessengerSettingsDB participant NotificationChecks MessengerFeature->>readMessengerDndUntil: refresh on startup, focus, or interval readMessengerDndUntil->>MessengerSettingsDB: query settings by converted account ID MessengerSettingsDB-->>readMessengerDndUntil: return globalMuteUntil or no row readMessengerDndUntil-->>MessengerFeature: return parsed expiry, 0, or null MessengerFeature->>NotificationChecks: update stored Do Not Disturb state NotificationChecks->>NotificationChecks: combine Do Not Disturb and global mute settings **Possibly related issues** - Carrier issue 353: The change reads `notification_settings.globalMuteUntil` and suppresses alerts when that Do Not Disturb state is active. - Carrier issue 349: The tracking issue includes the account-level Do Not Disturb behavior implemented here.
    Merge Risk: <picture></picture> Minimal · up to 039ea

    The Do Not Disturb change is mergeable after normal checks. The remaining questions do not establish a user-facing failure.
    Pre-merge checks: <picture>Passed</picture> 3 · <picture>Failed</picture> 2

    <picture>Failed</picture> Failed checks: 2 warnings | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 18.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… | Write docstrings for the functions missing them to satisfy the coverage threshold. | | Description check | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | The description explains the problem and change, but omits the AI models section required for contributors other than the repository owner. It also omits the Summary heading. | Add a Summary heading and an AI models used section. If the author is not the repository owner, list each model and its most specific available version, or write None if no AI was used. |
    <picture>Passed</picture> Passed checks: 3 passed

    | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly describes the main change: honoring Messenger's Do Not Disturb setting. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. |
    Full details: Docstring Coverage

    **Explanation** Docstring coverage is 18.75% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 16 functions across 7 files. (1 skipped: 1 unsupported.) **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold.
    Finishing Touches

    Generate docstrings

    - [ ] Commit to this branch - [ ] Create a new PR
    Generate unit tests (beta)

    - [ ] Commit to this branch - [ ] 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

    - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
     
  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: kristofferR

    ⏸️ crq will not request further automated reviews for this pull request.

    Reason: CodeRabbit reviews these changes once, in combined PR [#394]

    Resume with crq unhold kristofferr/carrier 378.

     

    Related

    Tickets: #394

  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: kristofferR

    [!NOTE]
    🤖 Claude Opus 5.5 responding on behalf of Kristoffer

    @codex review

     
  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. Another round soon, please!

    Reviewed commit: 687f638182

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
     
  • Anonymous

    Anonymous - 2026-11-07

    Ticket changed by: kristofferR

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-11-07

    Originally posted by: kristofferR

    ✅ The administrative hold has been retired because this pull request merged. crq will not request further automated reviews.

     

Log in to post a comment.