-
Notifications
You must be signed in to change notification settings - Fork 773
feat: Add desktop notification for user logout events #3108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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.
WalkthroughAdded 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (1)src/servers/main.ts (3)
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.
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. Comment |
Closes #2951
Changes
src/servers/main.tsthat monitors user login state changesuserLoggedOutmessage insrc/i18n/en.i18n.jsonImplementation Details
The solution builds on the existing user login detection system (
Meteor.userId()monitoring ininjected.ts) that already dispatchesWEBVIEW_USER_LOGGED_INactions. A new listener detects when users transition from logged in to logged out and shows a desktop notification.Screenshot
Summary by CodeRabbit
New Features
Chores