Skip to content

feat: Add invisible mode to hide user online activity status#167

Open
Shivangi1515 wants to merge 2 commits into
0rigin-c0de:mainfrom
Shivangi1515:feature/invisible-mode
Open

feat: Add invisible mode to hide user online activity status#167
Shivangi1515 wants to merge 2 commits into
0rigin-c0de:mainfrom
Shivangi1515:feature/invisible-mode

Conversation

@Shivangi1515
Copy link
Copy Markdown

Closes #159

PR Description: Add Invisible Mode to Hide User Online Activity Status

Description

This PR adds an Invisible Mode feature allowing users to use the chat application normally without showing their online status to others. When enabled, other users see the user as offline/invisible, and the user's local online indicator is disabled.

Screenshots

Screenshot 2026-05-24 190928

After Enabling the Invisible Mode

Screenshot 2026-05-24 191059

Changed Files & Code Paths

1. Database and Models

  • User.js
    • Added invisible_mode schema type definition.

2. Backend Routes and Authentication

  • authJwtPayload.js
    • Updated buildAuthUserJwtPayload to pack invisible_mode inside the JWT claims.
  • profile.js
    • Allowed the invisible_mode parameter in /profile PATCH endpoint.

3. Presence Logic

  • index.js (Socket Handler)
    • Added invisibleUsers tracking Set.
    • Filtered out invisible users from presence_snapshot.
    • Prevented status broadcasts on connection and disconnection for invisible users.
    • Added presence_status_change socket listener to handle real-time toggle.

4. Frontend State

  • userCredsSlice.js
    • Initialized invisible_mode in the Redux store.
    • Exposed the set_invisible_mode action reducer.
  • Dashboard.jsx
    • Decoded and stored the invisible_mode state from JWT on app initialization.

5. UI Components

  • Navbar2.jsx
    • Listened to invisible_mode state and replaced the green online dot with a grey offline indicator at the bottom-left avatar when enabled.
  • SettingsDialog.jsx
    • Rendered the "Invisible Mode" switch toggle inside the User Profile settings.
    • Integrated saving status into the PATCH request and emitted WebSocket updates on status transitions.

@Shivangi1515 Shivangi1515 requested a review from 0rigin-c0de as a code owner May 24, 2026 13:47
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 24, 2026

@Shivangi1515 is attempting to deploy a commit to the Sunil Kumar's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Shivangi1515
Copy link
Copy Markdown
Author

Hi @0rigin-c0de

I have submitted the PR for the issue #159 . Kindly review it .

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.

[Feature]: Add invisible mode to hide user online activity status

1 participant