Skip to content

feat: status visibility - #41747

Draft
ricardogarim wants to merge 8 commits into
developfrom
feat/status-visibility
Draft

feat: status visibility#41747
ricardogarim wants to merge 8 commits into
developfrom
feat/status-visibility

Conversation

@ricardogarim

@ricardogarim ricardogarim commented Aug 11, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Adds status visibility: control over who can see a user's presence and status message. Off by default, behind Accounts_StatusVisibility_Enabled and the presence licence modules.

Three scopes. Roles grant, named people block — nothing can widen.

Scope Set by Holds Effect
System-wide default admin, workspace setting roles grants
Per-user admin, on the user roles grants
Per-user admin, on the user people blocks
Per-user the user, on themselves people blocks

Resolution: a viewer sees the status if they hold one of the granted roles and appear in neither block list. An unset scope means "everyone", so an unconfigured workspace behaves exactly as today.

Use cases

  • Admin restricts presence workspace-wide to certain roles
  • Admin restricts one user — contractors visible only to managers and HR
  • Admin blocks specific people from seeing a given user
  • A user blocks specific people from seeing them, at any time, and lifts it later
  • Admins with view-restricted-user-status always see the real status; so does the user themselves

Anyone outside the result sees that user as offline — status, text, source, expiry, default and connection all suppressed together, so it is indistinguishable from genuinely offline. Blocking takes effect immediately, with no reload.

Issue(s)

Steps to test or reproduce

  1. Admin → Settings → Accounts → Status Visibility → enable
  2. Admin → Users → edit a user → set roles that can see, and/or people blocked
  3. My Account → Profile → block someone from seeing your status
  4. As the blocked user (not an admin — admins bypass), confirm the target shows as offline, live
  5. Turn the toggle off and confirm presence behaves exactly as before

Further comments

Enforcement is one predicate applied at every read surface (users.presence, users.list, users.info, im.members, spotlight, getUserStatusText) and on the presence stream. Verdicts are resolved once per subscription and cached, because the emit path is synchronous and cannot query.

Summary by CodeRabbit

  • New Features
    • Added configurable status visibility controls for workspace defaults, roles, and individual users.
    • Users can restrict which people may view their status.
    • Administrators can manage status visibility settings and grant permission to view restricted statuses.
    • Status and presence information is automatically hidden when viewing access is not permitted.
  • Bug Fixes
    • Updated presence, user lists, direct messages, search, and status responses to consistently respect visibility restrictions.

@dionisio-bot

dionisio-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: adf7ebe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f71437a-5fa4-4ce7-8652-8f99f837e93e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds configurable status visibility with role and user denials. The change persists visibility settings, caches access decisions, masks restricted statuses across APIs and presence events, and adds account and admin controls.

Changes

Status visibility controls and contracts

Layer / File(s) Summary
Contracts, settings, and controls
packages/core-typings/src/IUser.ts, packages/rest-typings/..., apps/meteor/server/settings/accounts.ts, apps/meteor/client/..., packages/i18n/...
Adds status visibility fields, settings, API validation, permission labels, feature gating, and account and admin form controls.

Visibility enforcement

Layer / File(s) Summary
Visibility policy and caching
apps/meteor/server/lib/statusVisibility*.ts, packages/models/src/models/Users.ts
Evaluates role, license, permission, self-view, and denial rules. Caches viewer-target decisions and supports invalidation.
Persistence and invalidation wiring
apps/meteor/server/lib/users/saveUser/*, apps/meteor/server/meteor-methods/users/saveUserPreferences.ts, apps/meteor/server/startup/*, apps/meteor/server/modules/listeners/listeners.module.ts
Stores visibility settings, resolves denied usernames, and propagates changes through events and startup listeners.

Response and presence handling

Layer / File(s) Summary
User and API response redaction
apps/meteor/server/lib/users/getFullUserData.ts, apps/meteor/server/api/v1/*, apps/meteor/server/publications/spotlight.ts, apps/meteor/server/meteor-methods/users/getUserStatusText.ts
Redacts restricted status fields and returns unavailable status text across user, DM, spotlight, list, and presence responses.
Presence masking and corrections
apps/meteor/server/lib/notifications/core/lib/Presence.ts
Masks restricted presence as offline, tracks active clients, warms visibility data, and emits corrected presence updates.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant AdminUserForm
  participant saveUser
  participant StatusVisibilityChecker
  participant Presence
  Admin->>AdminUserForm: change visibility roles or denied users
  AdminUserForm->>saveUser: submit visibility settings
  saveUser->>StatusVisibilityChecker: invalidate visibility decisions
  StatusVisibilityChecker->>Presence: notify visibility change
  Presence-->>AdminUserForm: emit corrected presence state
Loading

Suggested labels: type: feature

Suggested reviewers: sampaiodiego, ggazzo, kevlehman

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding status visibility controls.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2522: Request failed with status code 401

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.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.68817% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.03%. Comparing base (742009a) to head (adf7ebe).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41747      +/-   ##
===========================================
- Coverage    69.04%   69.03%   -0.01%     
===========================================
  Files         4224     4228       +4     
  Lines       166089   166448     +359     
  Branches     29557    29658     +101     
===========================================
+ Hits        114669   114903     +234     
- Misses       46261    46372     +111     
- Partials      5159     5173      +14     
Flag Coverage Δ
e2e 58.89% <61.53%> (-0.04%) ⬇️
e2e-api 45.65% <31.50%> (-0.40%) ⬇️
unit 70.99% <84.11%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Aug 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/meteor/server/api/v1/im.ts`:
- Around line 596-603: The membersWithSubscriptionInfo mapping currently exposes
subscription.status for restricted members; when canSee(member._id) is false,
remove or normalize that field to offline while preserving visible members’
subscription data. Update the subscription construction in the
membersWithSubscriptionInfo callback and add a regression test covering a denied
DM member.

In `@apps/meteor/server/lib/statusVisibilityChecker.ts`:
- Around line 94-105: Update the target reconciliation loop around
restrictedTargets and known so targets confirmed by the current model query as
no longer configured are removed from restrictedTargets, allowing unrestricted
targets to remain visible after invalidation. Preserve the fail-closed behavior
for targets whose current configuration is unknown, and keep configured
restricted targets marked as before.

In `@apps/meteor/server/lib/users/saveUser/saveNewUser.ts`:
- Around line 63-69: In the new-user save flow, update the code after
Users.updateFromUpdater to call notifyStatusVisibilityChanged with the newly
created user’s _id as the sole target. Ensure this notification runs after both
status visibility fields have been persisted, matching the existing saveUser.ts
behavior.

In `@apps/meteor/server/lib/users/saveUser/saveUser.ts`:
- Around line 42-43: Update the unresolved deny-list input type in saveUser’s
options declaration from IUser['_id'][] to string[] (or the project’s non-null
username type), matching resolveStatusVisibilityDenied’s username-based lookup;
retain IUser['_id'][] only for the persisted user field.

In `@apps/meteor/server/modules/listeners/listeners.module.ts`:
- Around line 157-162: Update the presence.invalidateVisibility handler to
derive correction targets from all invalidation modes: use the provided targets,
select watched targets associated with viewers when only viewers are provided,
and select all active presence subscriptions for global invalidations with
neither field. Pass the resulting targets to pushStatusVisibilityCorrection so
connected clients are corrected immediately while preserving the existing
empty-target guard.

In `@packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts`:
- Around line 187-191: Remove nullable: true from every visibility array
property in packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
(lines 187-191), packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
(lines 40-41), and packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
(lines 73-82). Keep each property as an array of strings so the schemas reject
null consistently with the TypeScript contracts.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc931a02-7b60-4ca9-b178-409ea87d6b00

📥 Commits

Reviewing files that changed from the base of the PR and between 93aa04b and dbea66e.

📒 Files selected for processing (33)
  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/jest.config.ts
  • apps/meteor/server/api/v1/im.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • packages/core-services/src/events/Events.ts
  • packages/core-typings/src/IUser.ts
  • packages/i18n/src/locales/en.i18n.json
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/models/src/models/Users.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • apps/meteor/jest.config.ts
  • packages/core-services/src/events/Events.ts
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • packages/models/src/models/Users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/api/v1/im.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
apps/meteor/**

📄 CodeRabbit inference engine (CLAUDE.md)

The main Rocket.Chat Meteor application resides in apps/meteor/; place its application code there rather than in other monorepo areas.

Files:

  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • apps/meteor/jest.config.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/api/v1/im.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
packages/**

📄 CodeRabbit inference engine (CLAUDE.md)

Shared libraries belong in packages/, while other services belong in apps/ and ee/.

Files:

  • packages/core-services/src/events/Events.ts
  • packages/core-typings/src/IUser.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/models/src/models/Users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • packages/i18n/src/locales/en.i18n.json
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
🧠 Learnings (15)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • apps/meteor/jest.config.ts
  • packages/core-services/src/events/Events.ts
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • packages/models/src/models/Users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/api/v1/im.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • apps/meteor/jest.config.ts
  • packages/core-services/src/events/Events.ts
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • packages/models/src/models/Users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/api/v1/im.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • apps/meteor/jest.config.ts
  • packages/core-services/src/events/Events.ts
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • packages/models/src/models/Users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/api/v1/im.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
📚 Learning: 2026-08-05T22:02:59.828Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41707
File: apps/meteor/server/hooks/messages/processThreads.ts:66-68
Timestamp: 2026-08-05T22:02:59.828Z
Learning: In Rocket.Chat Meteor server code, `callbacks.runAsync` returns its input item rather than the asynchronous callback promise. Callers of `afterReadMessages` must invoke `callbacks.runAsync` without awaiting it, keeping read-receipt I/O off the message-send path; this includes `apps/meteor/server/hooks/messages/processThreads.ts`.

Applied to files:

  • apps/meteor/server/startup/index.ts
  • apps/meteor/server/startup/statusVisibility.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/server/lib/resolveStatusVisibilityDenied.ts
  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/meteor-methods/users/getUserStatusText.ts
  • apps/meteor/server/lib/users/saveUser/saveNewUser.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
  • apps/meteor/server/publications/spotlight.ts
  • apps/meteor/server/lib/users/getFullUserData.ts
  • apps/meteor/server/api/v1/im.ts
  • apps/meteor/server/lib/statusVisibility.ts
  • apps/meteor/server/modules/listeners/listeners.module.ts
  • apps/meteor/server/lib/authorization/constant/permissions.ts
  • apps/meteor/server/lib/statusVisibilityChecker.ts
  • apps/meteor/server/lib/users/saveUser/saveUser.ts
  • apps/meteor/server/lib/notifications/core/lib/Presence.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
📚 Learning: 2026-05-11T23:14:59.316Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 40469
File: packages/rest-typings/src/v1/users.ts:337-337
Timestamp: 2026-05-11T23:14:59.316Z
Learning: In Rocket.Chat REST endpoint typings (e.g., packages/rest-typings/src/v1/users.ts and other rest-typings files), keep the established convention of deriving field types from the domain model (e.g., use IUser indexed access like IUser['statusExpiresAt']) rather than swapping individual fields to serialized primitives (like string) in an ad-hoc way. If a truly different “serialized” representation is needed, perform the refactor consistently across the codebase (not just a single endpoint/field) and ensure all related REST typings stay aligned with the shared serialization types.

Applied to files:

  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
📚 Learning: 2026-04-14T21:10:31.855Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 36292
File: apps/meteor/client/hooks/useHasValidLocationHash.ts:7-12
Timestamp: 2026-04-14T21:10:31.855Z
Learning: When reviewing files in apps/meteor/client/hooks/, do not treat JSDoc-style comments on React hooks (especially exported hooks) as a violation of any “avoid code comments in implementation” guideline. It’s acceptable to use JSDoc to document the public API of exported hooks (e.g., parameter/return types, intended usage), as long as it documents behavior/contracts rather than adding narrative implementation comments.

Applied to files:

  • apps/meteor/client/hooks/useStatusVisibilityEnabled.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/server/lib/statusVisibility.spec.ts
  • apps/meteor/server/lib/statusVisibilityChecker.spec.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/views/account/profile/AccountProfilePage.tsx
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
📚 Learning: 2026-07-29T23:45:21.859Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 41632
File: apps/meteor/server/api/v1/groups.ts:948-959
Timestamp: 2026-07-29T23:45:21.859Z
Learning: For API v1 routes under apps/meteor/server/api/v1, keep item-level response schemas strict by using `$ref`-based schemas for list and messages (and ensure they intentionally mirror the corresponding route contracts, as done in channels.ts). Only use “loose”/non-`$ref` item schemas when the underlying data source is inherently partial (e.g., uploads where `content` can be `null`, or queries like `findUsersOfRoom` with a fixed projection). Do not relax item schemas merely because the route supports an optional client `fields` projection—optional field selection alone is not a reason to change schema strictness.

Applied to files:

  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/api/v1/im.ts
📚 Learning: 2026-07-31T02:44:35.111Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 41635
File: apps/meteor/ee/server/api/sessions.ts:114-138
Timestamp: 2026-07-31T02:44:35.111Z
Learning: In Rocket.Chat typed REST response schemas, accept the composition of a Typia-generated entity schema with an `allOf` branch requiring `success: true`: `allOf: [{ $ref: <entity schema> }, { properties: { success: { type: 'boolean', enum: [true] } }, required: ['success'] }]`. Do not flag this pattern when used for REST endpoints, provided TEST_MODE response validation passes, as demonstrated by the `IOAuthApps` and `IEmailInbox` endpoints.

Applied to files:

  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/api/v1/im.ts
📚 Learning: 2026-07-15T01:31:50.632Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 41382
File: packages/model-typings/src/models/IPushTokenModel.ts:10-10
Timestamp: 2026-07-15T01:31:50.632Z
Learning: In Rocket.Chat’s push-token model, APNs/GCM standard tokens and PushKit VoIP tokens use distinct, globally-unique token string values. As a result, when deduplicating/looking up tokens, key identity solely on `{ tokenValue, appName }` (e.g., for `findOneByTokenAndAppName`, `removeDuplicateTokens`) and do **not** include `tokenType` in the uniqueness criteria to avoid collisions between standard and VoIP tokens.

Applied to files:

  • packages/models/src/models/Users.ts
  • packages/model-typings/src/models/IUsersModel.ts
📚 Learning: 2026-08-10T13:36:55.243Z
Learnt from: abhinavkrin
Repo: RocketChat/Rocket.Chat PR: 41736
File: packages/i18n/src/locales/th-TH.i18n.json:398-398
Timestamp: 2026-08-10T13:36:55.243Z
Learning: During the coordinated i18n interpolation migration for `Channel_already_exist`, do not flag locale files that still use `%s` until the English base translation and all affected locales are converted together to `{{channelName}}`. Partial locale-only conversions fail the i18n `extra-placeholders` check; the coordinated conversion is owned by the related migration change.

Applied to files:

  • packages/i18n/src/locales/en.i18n.json
🔇 Additional comments (25)
apps/meteor/server/lib/resolveStatusVisibilityDenied.ts (1)

1-12: LGTM!

apps/meteor/server/meteor-methods/users/saveUserPreferences.ts (1)

15-16: LGTM!

Also applies to: 59-59, 136-136, 177-180, 198-201

packages/core-services/src/events/Events.ts (1)

160-160: LGTM!

apps/meteor/server/startup/index.ts (1)

9-9: LGTM!

apps/meteor/server/startup/statusVisibility.ts (1)

1-12: LGTM!

apps/meteor/server/lib/notifications/core/lib/Presence.ts (1)

1-9: LGTM!

Also applies to: 25-36, 50-57, 72-77, 94-100, 112-112, 131-136, 157-186

packages/core-typings/src/IUser.ts (1)

193-194: LGTM!

apps/meteor/server/lib/authorization/constant/permissions.ts (1)

79-79: LGTM!

apps/meteor/server/settings/accounts.ts (1)

776-795: LGTM!

packages/model-typings/src/models/IUsersModel.ts (1)

356-356: LGTM!

apps/meteor/client/hooks/useStatusVisibilityEnabled.ts (1)

1-11: LGTM!

apps/meteor/client/views/account/profile/AccountProfileForm.tsx (1)

29-38: LGTM!

Also applies to: 49-51, 146-146, 174-177, 292-306

apps/meteor/client/views/account/profile/AccountProfilePage.tsx (1)

15-15: LGTM!

Also applies to: 40-49

apps/meteor/client/views/account/profile/getProfileInitialValues.ts (1)

16-19: LGTM!

Also applies to: 29-29

apps/meteor/client/views/admin/users/AdminUserForm.tsx (1)

43-46: LGTM!

Also applies to: 89-90, 117-117, 178-189, 198-200, 514-550

packages/i18n/src/locales/en.i18n.json (1)

308-318: LGTM!

Also applies to: 7307-7307

packages/models/src/models/Users.ts (1)

2327-2345: LGTM!

apps/meteor/server/lib/statusVisibility.ts (1)

1-73: LGTM!

apps/meteor/server/lib/statusVisibility.spec.ts (1)

1-145: LGTM!

apps/meteor/jest.config.ts (1)

54-54: LGTM!

apps/meteor/server/lib/users/getFullUserData.ts (1)

7-8: LGTM!

Also applies to: 43-44, 127-127, 147-166

apps/meteor/server/api/v1/users.ts (1)

52-53: LGTM!

Also applies to: 252-254, 770-776, 1566-1571, 1581-1601

apps/meteor/server/meteor-methods/users/getUserStatusText.ts (1)

5-5: LGTM!

Also applies to: 23-25

apps/meteor/server/publications/spotlight.ts (1)

7-8: LGTM!

Also applies to: 71-76

apps/meteor/server/lib/statusVisibilityChecker.ts (1)

20-21: 🔒 Security & Privacy

Remove the await recommendation. License.hasModule returns a synchronous boolean, so the second call is not an unresolved Promise and cannot enable status visibility incorrectly.

			> Likely an incorrect or invalid review comment.

Comment thread apps/meteor/server/api/v1/im.ts
Comment thread apps/meteor/server/lib/statusVisibilityChecker.ts Outdated
Comment thread apps/meteor/server/lib/users/saveUser/saveNewUser.ts
Comment thread apps/meteor/server/lib/users/saveUser/saveUser.ts Outdated
Comment thread apps/meteor/server/modules/listeners/listeners.module.ts Outdated
Comment thread packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
@ricardogarim
ricardogarim force-pushed the feat/status-visibility branch from 2df6667 to adf7ebe Compare August 12, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant