Skip to content

Conversation

@Dark-Kernel
Copy link

@Dark-Kernel Dark-Kernel commented Sep 28, 2025

  • Displays 'You've been logged out' notification when users are randomly logged out
  • Helps users quickly notice logout events and reconnect promptly during working hours

Closes #2951

Changes

  • Notification System: Added logout detection listener in src/servers/main.ts that monitors user login state changes
  • Internationalization: Added userLoggedOut message in src/i18n/en.i18n.json
  • Integration: Leverages existing notification infrastructure and user login monitoring

Implementation Details

The solution builds on the existing user login detection system (Meteor.userId() monitoring in injected.ts) that already dispatches WEBVIEW_USER_LOGGED_IN actions. A new listener detects when users transition from logged in to logged out and shows a desktop notification.

Screenshot

1759069566

Summary by CodeRabbit

  • New Features

    • Shows a notification when you are logged out of a connected service, helping you quickly identify session changes.
  • Chores

    • Updated English localization to include a “You’ve been logged out” message.

Displays 'You've been logged out' notification when users are randomly
logged out, helping maintain awareness during working hours and enabling
prompt reconnection to maintain productivity.
@CLAassistant
Copy link

CLAassistant commented Sep 28, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 28, 2025

Walkthrough

Added a new i18n string for a logout notification and implemented login state tracking in the main server process to detect logout events per URL and dispatch a desktop notification using the new translation key.

Changes

Cohort / File(s) Summary
i18n updates
src/i18n/en.i18n.json
Added downloads.notifications.userLoggedOut: "You've been logged out", added a trailing comma after the preceding entry, and ensured a newline at EOF.
Login state + notification logic
src/servers/main.ts
Imported i18n and createNotification; tracked per-URL login state; listened for WEBVIEW_USER_LOGGED_IN; on transition to logged out, dispatched a notification with i18n.t('downloads.notifications.userLoggedOut'); guarded updates to boolean values only.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant WV as Webview
  participant MP as Main Process (servers/main.ts)
  participant I18N as i18n
  participant Notif as Notification Service
  participant OS as Desktop OS

  WV->>MP: WEBVIEW_USER_LOGGED_IN { url, userLoggedIn }
  alt userLoggedIn is boolean
    MP->>MP: Update userLoginStates[url]
    opt Transition: true -> false (logged out)
      MP->>I18N: t('downloads.notifications.userLoggedOut')
      I18N-->>MP: "You've been logged out"
      MP->>Notif: createNotification(title="You've been logged out", body="")
      Notif->>OS: Show desktop notification
    end
  else Non-boolean payload
    MP->>MP: Ignore (no state mutation)
  end

  note over MP,Notif: New: per-URL state tracking and logout notification
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit taps its tiny paw—ping! a note in view,
“You’ve been logged out,” the screen declares, crisp and true.
I twitch my ears, then hop back in,
With strings translated, signals thin.
Alerts now bloom like morning dew—
Back to the burrow, and back to you. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately summarizes the main feature introduced—adding desktop notifications for user logout events—without extraneous details or vague language.
Linked Issues Check ✅ Passed The pull request implements the core requirement from issue #2951 by adding the “you’ve been logged out” translation entry and wiring up a listener in src/servers/main.ts that detects a transition from logged in to logged out and dispatches a desktop notification using the existing notification infrastructure.
Out of Scope Changes Check ✅ Passed All modifications are focused on implementing the desktop logout notification feature as specified in issue #2951, with no extraneous changes introduced outside of the translation update and logout detection logic in the server code.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f566baa and 2e105be.

📒 Files selected for processing (2)
  • src/i18n/en.i18n.json (2 hunks)
  • src/servers/main.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow existing TypeScript patterns with strict mode enabled
All new code must pass ESLint and TypeScript checks
Avoid unnecessary comments; only add comments for complex logic or non-obvious decisions

Files:

  • src/servers/main.ts
🧬 Code graph analysis (1)
src/servers/main.ts (3)
src/store/index.ts (2)
  • listen (88-114)
  • listen (144-157)
src/ui/actions.ts (1)
  • WEBVIEW_USER_LOGGED_IN (84-84)
src/notifications/preload.ts (1)
  • createNotification (32-64)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

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

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.

Desktop notification when user logged out

2 participants