feat: presence sync engine UI#40469
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
WalkthroughThis PR adds user status expiration with configurable auto-clear duration. It extends the type system to include ChangesStatus Expiration Feature
🎯 4 (Complex) | ⏱️ ~60 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (3)
Timed out fetching pipeline failures after 30000ms Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
d35ed87 to
9f10aca
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/presence-sync-engine #40469 +/- ##
=============================================================
+ Coverage 69.58% 69.92% +0.34%
=============================================================
Files 3318 3314 -4
Lines 122127 121425 -702
Branches 21857 21772 -85
=============================================================
- Hits 84981 84908 -73
+ Misses 33818 33205 -613
+ Partials 3328 3312 -16
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
eb2c66c to
5dd9075
Compare
5dd9075 to
24d4734
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (2)
apps/meteor/client/components/UserStatusText/useExpirationText.ts (1)
7-7: ⚡ Quick winRemove inline implementation comment.
Please drop the comment on Line 7 to match project style for implementation files.
As per coding guidelines "Avoid code comments in the implementation".
🤖 Prompt for 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. In `@apps/meteor/client/components/UserStatusText/useExpirationText.ts` at line 7, Remove the inline implementation comment in the module that begins with "Handles Date, ISO string, and EJSON { $date }..." inside useExpirationText.ts (the useExpirationText hook/function); simply delete that comment line so the file conforms to the "no implementation comments" guideline and ensure the file still builds/linters pass after removal.apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts (1)
22-24: ⚡ Quick winPrefer a semantic locator for the duration control.
Line 23 relies on an ID suffix and couples the page object to implementation details. Use label-based lookup for better resilience.
Proposed fix
private get durationSelect() { - return this.root.locator('[id$="-clear-after"]'); + return this.root.getByLabel('Clear status after'); }Based on learnings: In Rocket.Chat e2e tests, prefer semantic locators (
getByRole,getByLabel,getByText,getByTitle) for reliability and maintainability.🤖 Prompt for 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. In `@apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts` around lines 22 - 24, The durationSelect getter currently uses an ID-suffix selector which couples the page object to implementation details; replace it with a semantic locator such as a label- or role-based lookup. Update the durationSelect getter (in the edit-status-modal fragment) to return this.root.getByLabel('Clear after') or this.root.getByRole('combobox', { name: /clear after/i }) (choose the one matching the control) so the test targets the labeled duration control semantically.
🤖 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/app/api/server/v1/users.ts`:
- Line 2005: The spread that sets statusExpiresAt from this.bodyParams.expiresAt
should validate the date before converting; create a Date from
this.bodyParams.expiresAt, check !isNaN(date.getTime()) (or Date.parse) and only
include statusExpiresAt: date when valid, otherwise either omit the property or
throw a validation error. Update the code around the spread that currently does
...(this.bodyParams.expiresAt && { statusExpiresAt: new
Date(this.bodyParams.expiresAt) }) and ensure Presence.setActiveState receives a
valid Date object (or handle invalid input by returning a 4xx response).
In `@apps/meteor/client/components/UserStatusText/useExpirationText.ts`:
- Around line 17-19: The branch in useExpirationText that handles EJSON objects
currently returns new Date((value as { $date: number }).$date) without
validating the $date, which can produce Invalid Date; update the branch (the
typeof value === 'object' && '$date' in (value as Record<string, unknown>)
check) to first extract and coerce the $date (e.g., Number((value as { $date:
unknown }).$date)), ensure it is a finite number (or parseable to a valid
timestamp) and only then return new Date(timestamp); otherwise fall through to
the same fallback/return behavior used by the other branches so an Invalid Date
is never returned from useExpirationText.
In
`@apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsx`:
- Around line 124-133: computeExpiresAt can produce an invalid Date when
customDate/customTime are empty or malformed; update computeExpiresAt (used with
duration, customDate, customTime and DURATION_OPTIONS) to validate the
constructed Date (e.g., check isNaN(date.getTime())) and return undefined for
invalid custom inputs, and in the save/submit path where you call
expiresAt.toISOString() (the code that consumes computeExpiresAt) add a guard to
block submission when computeExpiresAt() returns undefined (show validation
error / disable save) so you never call toISOString() on an invalid Date.
- Around line 99-100: The date input currently uses the state variable
customDate as its min which causes the selected date to become its own lower
bound; change the component to compute a stable minimum (e.g. a "today" string
in 'en-CA' format) outside of the mutable customDate state and use that stable
value for the date input's min prop. Keep the existing customDate and customTime
state initializers (useState(() => new Date().toLocaleDateString('en-CA')) and
useState(() => new Date().toTimeString().slice(0,5))) but add a separate
variable (e.g. todayMin or todayDate) computed once per render (or via useMemo)
and reference that in the date input's min attribute instead of customDate;
update references to the date input in EditStatusModal to use that new stable
min.
In `@apps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsx`:
- Around line 46-47: The memo comparator for the SidebarItemTemplateWithData
component is missing userId as an input, yet userId affects dmUserId (and
therefore DM presence/tooltip); update the React.memo comparator (the custom
equality function used when wrapping SidebarItemTemplateWithData) to include
props.userId in its comparison set so a change from undefined→loaded (or any
userId change) forces a re-render; ensure any places computing dmUserId (the
dmUserId variable) are covered by the comparator inputs as well.
In `@packages/rest-typings/src/v1/users.ts`:
- Line 337: The REST response typing is exposing a raw Date via
statusExpiresAt?: IUser['statusExpiresAt'];—change the property to a serialized
date type (e.g. statusExpiresAt?: string | null) so clients receive an ISO
string (or null) instead of a Date; update the type in the users REST response
interface where statusExpiresAt is defined and ensure any serializers convert
the Date to an ISO string before sending.
---
Nitpick comments:
In `@apps/meteor/client/components/UserStatusText/useExpirationText.ts`:
- Line 7: Remove the inline implementation comment in the module that begins
with "Handles Date, ISO string, and EJSON { $date }..." inside
useExpirationText.ts (the useExpirationText hook/function); simply delete that
comment line so the file conforms to the "no implementation comments" guideline
and ensure the file still builds/linters pass after removal.
In `@apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts`:
- Around line 22-24: The durationSelect getter currently uses an ID-suffix
selector which couples the page object to implementation details; replace it
with a semantic locator such as a label- or role-based lookup. Update the
durationSelect getter (in the edit-status-modal fragment) to return
this.root.getByLabel('Clear after') or this.root.getByRole('combobox', { name:
/clear after/i }) (choose the one matching the control) so the test targets the
labeled duration control semantically.
🪄 Autofix (Beta)
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
Run ID: dfee8651-3f4f-44ee-a64e-9ed27c8b38d8
⛔ Files ignored due to path filters (1)
apps/meteor/client/components/UserInfo/__snapshots__/UserInfo.spec.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (36)
apps/meteor/app/api/server/helpers/getUserFromParams.tsapps/meteor/app/api/server/v1/users.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/app/notifications/client/lib/Presence.tsapps/meteor/app/utils/server/functions/getBaseUserFields.tsapps/meteor/client/components/UserInfo/UserInfo.tsxapps/meteor/client/components/UserStatusText/UserStatusText.tsxapps/meteor/client/components/UserStatusText/index.tsapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/client/components/UserStatusText/useStatusTooltip.tsxapps/meteor/client/lib/presence.spec.tsapps/meteor/client/lib/presence.tsapps/meteor/client/lib/userData.tsapps/meteor/client/lib/userStatuses.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsxapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsxapps/meteor/client/sidebar/RoomList/RoomList.tsxapps/meteor/client/sidebar/RoomList/RoomListRow.tsxapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/client/views/room/Header/RoomTopic.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsxapps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembersItem.tsxapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/server/modules/listeners/listeners.module.tsapps/meteor/server/modules/notifications/notifications.module.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.tsapps/meteor/tests/e2e/presence.spec.tsapps/meteor/tests/end-to-end/api/users.tsee/packages/presence/src/Presence.tspackages/core-services/src/events/Events.tspackages/core-typings/src/IMeApiUser.tspackages/core-typings/src/IUser.tspackages/ddp-client/src/types/streams.tspackages/i18n/src/locales/en.i18n.jsonpackages/rest-typings/src/v1/users.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (4/4)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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/client/lib/userStatuses.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsxapps/meteor/client/sidebar/RoomList/RoomList.tsxapps/meteor/client/lib/presence.tsapps/meteor/client/lib/presence.spec.tsapps/meteor/client/components/UserStatusText/index.tsapps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembersItem.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsxee/packages/presence/src/Presence.tsapps/meteor/client/components/UserStatusText/UserStatusText.tsxpackages/core-typings/src/IMeApiUser.tspackages/core-services/src/events/Events.tsapps/meteor/app/notifications/client/lib/Presence.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/client/components/UserStatusText/useStatusTooltip.tsxapps/meteor/client/views/room/Header/RoomTopic.tsxpackages/core-typings/src/IUser.tsapps/meteor/app/utils/server/functions/getBaseUserFields.tsapps/meteor/client/sidebar/RoomList/RoomListRow.tsxapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/server/modules/listeners/listeners.module.tspackages/ddp-client/src/types/streams.tsapps/meteor/client/components/UserInfo/UserInfo.tsxapps/meteor/client/lib/userData.tsapps/meteor/server/modules/notifications/notifications.module.tsapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/app/api/server/v1/users.tsapps/meteor/app/api/server/helpers/getUserFromParams.tsapps/meteor/tests/e2e/presence.spec.tspackages/rest-typings/src/v1/users.tsapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/end-to-end/api/users.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsxapps/meteor/tests/e2e/page-objects/fragments/navbar.ts
**/*.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.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/client/lib/presence.spec.tsapps/meteor/tests/e2e/presence.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created inapps/meteor/tests/e2e/directory
Avoid usingpage.locator()in Playwright tests - always prefer semantic locators such aspage.getByRole(),page.getByLabel(),page.getByText(), orpage.getByTitle()
Usetest.beforeAll()andtest.afterAll()for setup/teardown in Playwright tests
Usetest.step()for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test,page,expect) for consistency in test files
Prefer web-first assertions (toBeVisible,toHaveText, etc.) in Playwright tests
Useexpectmatchers for assertions (toEqual,toContain,toBeTruthy,toHaveLength, etc.) instead ofassertstatements in Playwright tests
Usepage.waitFor()with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts
Files:
apps/meteor/tests/e2e/presence.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests
Files:
apps/meteor/tests/e2e/presence.spec.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.ts
apps/meteor/tests/e2e/page-objects/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Utilize existing page objects pattern from
apps/meteor/tests/e2e/page-objects/
Files:
apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.ts
🧠 Learnings (14)
📚 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/lib/userStatuses.tsapps/meteor/client/lib/presence.tsapps/meteor/client/lib/presence.spec.tsapps/meteor/client/components/UserStatusText/index.tsapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/client/lib/userData.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/lib/userStatuses.tsapps/meteor/client/lib/presence.tsapps/meteor/client/lib/presence.spec.tsapps/meteor/client/components/UserStatusText/index.tsapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/client/lib/userData.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 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/client/lib/userStatuses.tsapps/meteor/client/lib/presence.tsapps/meteor/client/lib/presence.spec.tsapps/meteor/client/components/UserStatusText/index.tsee/packages/presence/src/Presence.tspackages/core-typings/src/IMeApiUser.tspackages/core-services/src/events/Events.tsapps/meteor/app/notifications/client/lib/Presence.tsapps/meteor/app/lib/server/functions/getFullUserData.tspackages/core-typings/src/IUser.tsapps/meteor/app/utils/server/functions/getBaseUserFields.tsapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/server/modules/listeners/listeners.module.tspackages/ddp-client/src/types/streams.tsapps/meteor/client/lib/userData.tsapps/meteor/server/modules/notifications/notifications.module.tsapps/meteor/app/api/server/v1/users.tsapps/meteor/app/api/server/helpers/getUserFromParams.tsapps/meteor/tests/e2e/presence.spec.tspackages/rest-typings/src/v1/users.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/end-to-end/api/users.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.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/client/lib/userStatuses.tsapps/meteor/client/lib/presence.tsapps/meteor/client/lib/presence.spec.tsapps/meteor/client/components/UserStatusText/index.tsee/packages/presence/src/Presence.tspackages/core-typings/src/IMeApiUser.tspackages/core-services/src/events/Events.tsapps/meteor/app/notifications/client/lib/Presence.tsapps/meteor/app/lib/server/functions/getFullUserData.tspackages/core-typings/src/IUser.tsapps/meteor/app/utils/server/functions/getBaseUserFields.tsapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/server/modules/listeners/listeners.module.tspackages/ddp-client/src/types/streams.tsapps/meteor/client/lib/userData.tsapps/meteor/server/modules/notifications/notifications.module.tsapps/meteor/app/api/server/v1/users.tsapps/meteor/app/api/server/helpers/getUserFromParams.tsapps/meteor/tests/e2e/presence.spec.tspackages/rest-typings/src/v1/users.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/end-to-end/api/users.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.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/client/lib/userStatuses.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsxapps/meteor/client/sidebar/RoomList/RoomList.tsxapps/meteor/client/lib/presence.tsapps/meteor/client/lib/presence.spec.tsapps/meteor/client/components/UserStatusText/index.tsapps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembersItem.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsxee/packages/presence/src/Presence.tsapps/meteor/client/components/UserStatusText/UserStatusText.tsxpackages/core-typings/src/IMeApiUser.tspackages/core-services/src/events/Events.tsapps/meteor/app/notifications/client/lib/Presence.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/client/components/UserStatusText/useStatusTooltip.tsxapps/meteor/client/views/room/Header/RoomTopic.tsxpackages/core-typings/src/IUser.tsapps/meteor/app/utils/server/functions/getBaseUserFields.tsapps/meteor/client/sidebar/RoomList/RoomListRow.tsxapps/meteor/client/components/UserStatusText/useExpirationText.tsapps/meteor/server/modules/listeners/listeners.module.tspackages/ddp-client/src/types/streams.tsapps/meteor/client/components/UserInfo/UserInfo.tsxapps/meteor/client/lib/userData.tsapps/meteor/server/modules/notifications/notifications.module.tsapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/app/api/server/v1/users.tsapps/meteor/app/api/server/helpers/getUserFromParams.tsapps/meteor/tests/e2e/presence.spec.tspackages/rest-typings/src/v1/users.tsapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/end-to-end/api/users.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsxapps/meteor/tests/e2e/page-objects/fragments/navbar.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/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsxapps/meteor/client/sidebar/RoomList/RoomList.tsxapps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembersItem.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsxapps/meteor/client/components/UserStatusText/UserStatusText.tsxapps/meteor/client/components/UserStatusText/useStatusTooltip.tsxapps/meteor/client/views/room/Header/RoomTopic.tsxapps/meteor/client/sidebar/RoomList/RoomListRow.tsxapps/meteor/client/components/UserInfo/UserInfo.tsxapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsx
📚 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/client/lib/presence.spec.tsapps/meteor/tests/e2e/presence.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/client/lib/presence.spec.tsapps/meteor/tests/e2e/presence.spec.ts
📚 Learning: 2026-02-23T17:53:06.802Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:06.802Z
Learning: During PR reviews that touch endpoint files under apps/meteor/app/api/server/v1, enforce strict scope: if a PR targets a specific endpoint (e.g., rooms.favorite), do not propose changes to unrelated endpoints (e.g., rooms.invite) unless maintainers explicitly request them. Focus feedback on the touched endpoint's behavior, API surface, and related tests; avoid broad cross-endpoint changes in the same PR unless requested.
Applied to files:
apps/meteor/app/api/server/v1/users.ts
📚 Learning: 2026-02-24T19:09:01.522Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:01.522Z
Learning: In Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1, avoid introducing logic changes. Only perform scope-tight changes that preserve behavior; style-only cleanups (e.g., removing inline comments) may be deferred to follow-ups to keep the migration PR focused.
Applied to files:
apps/meteor/app/api/server/v1/users.ts
📚 Learning: 2026-03-15T14:31:25.380Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39647
File: apps/meteor/app/api/server/v1/users.ts:710-757
Timestamp: 2026-03-15T14:31:25.380Z
Learning: Do not flag this type/schema misalignment in the OpenAPI/migration review for apps/meteor/app/api/server/v1/users.ts. The UserCreateParamsPOST type intentionally uses non-optional fields: fields: string and settings?: IUserSettings without an AJV schema entry, carried over from the original rest-typings (PR `#39647`). Treat this as a known pre-existing divergence and document it as a separate follow-up fix; do not block or mark it as a review issue during the migration.
Applied to files:
apps/meteor/app/api/server/v1/users.ts
📚 Learning: 2026-03-16T23:33:11.443Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: apps/meteor/app/api/server/v1/users.ts:862-869
Timestamp: 2026-03-16T23:33:11.443Z
Learning: In rockets OpenAPI/AJV migration reviews for RocketChat/Rocket.Chat, when reviewing migrations that involve apps/meteor/app/api/server/v1/users.ts, do not require or flag a missing query AJV schema for the fields consumed by parseJsonQuery() (i.e., fields, sort, query) as part of this endpoint's migration PR. The addition of global query-param schemas for parseJsonQuery() usage is a cross-cutting concern and out of scope for individual endpoint migrations. Only flag violations related to the specific scope of the migration, not the absence of a query schema for parseJsonQuery() in this file.
Applied to files:
apps/meteor/app/api/server/v1/users.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.
Applied to files:
apps/meteor/tests/e2e/presence.spec.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.ts
📚 Learning: 2025-12-16T17:29:40.430Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:40.430Z
Learning: In all page-object files under apps/meteor/tests/e2e/page-objects/, import expect from ../../utils/test (Playwright's async expect) instead of from Jest. Jest's expect is synchronous and incompatible with web-first assertions like toBeVisible, which can cause TypeScript errors.
Applied to files:
apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.ts
🪛 ast-grep (0.42.2)
apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts
[warning] 40-40: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(duration)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (39)
apps/meteor/client/lib/userStatuses.ts (1)
16-26: LGTM!packages/i18n/src/locales/en.i18n.json (1)
5141-5148: LGTM!packages/core-typings/src/IUser.ts (1)
299-302: LGTM!packages/core-typings/src/IMeApiUser.ts (1)
31-32: LGTM!ee/packages/presence/src/Presence.ts (1)
353-353: LGTM!packages/core-services/src/events/Events.ts (1)
162-162: LGTM!apps/meteor/server/modules/notifications/notifications.module.ts (1)
2-2: LGTM!Also applies to: 490-493
apps/meteor/client/components/UserStatusText/useStatusTooltip.tsx (1)
8-38: LGTM!packages/rest-typings/src/v1/users.ts (1)
106-109: LGTM!Also applies to: 321-328
apps/meteor/app/utils/server/functions/getBaseUserFields.ts (1)
13-14: LGTM!apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx (1)
61-61: LGTM!Also applies to: 92-92
apps/meteor/client/views/room/UserCard/UserCardWithData.tsx (1)
13-13: LGTM!Also applies to: 49-50, 67-67
apps/meteor/client/lib/userData.ts (1)
21-22: LGTM!Also applies to: 163-165
apps/meteor/client/sidebar/RoomList/RoomList.tsx (1)
23-24: LGTM!Also applies to: 44-46
apps/meteor/app/lib/server/functions/getFullUserData.ts (1)
21-22: LGTM!apps/meteor/client/sidebar/RoomList/RoomListRow.tsx (1)
19-19: LGTM!Also applies to: 25-25, 51-51
apps/meteor/server/modules/listeners/listeners.module.ts (3)
160-160: LGTM!Also applies to: 175-177, 180-182
185-194: LGTM!
197-197: LGTM!apps/meteor/app/api/server/v1/users.ts (3)
1518-1529: LGTM!
2023-2038: LGTM!
2040-2059: LGTM!apps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembersItem.tsx (1)
57-67: LGTM!apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsx (1)
33-37: LGTM!apps/meteor/tests/e2e/presence.spec.ts (2)
97-120: LGTM!
78-95: Page object methods correctly use semantic locators.The page object implementations for
customDateInput,customTimeInput, andselectDurationall use semantic locators (getByLabelandgetByRole) as required. No changes needed.apps/meteor/client/components/UserStatusText/index.ts (1)
1-5: LGTM!apps/meteor/client/lib/presence.ts (1)
78-86: Date conversion correctly handles REST response strings.The conversion of
statusExpiresAtfrom ISO string toDateobject is correct for REST API responses. Based on learnings, DDP streams deliver Date objects via EJSON, but REST responses return JSON strings that require explicit conversion.The code correctly converts only when
statusExpiresAtis present. If server-side validation is added per the earlier comment onusers.setStatus, this will be fully defensive.apps/meteor/client/lib/presence.spec.ts (2)
52-76: LGTM!
78-100: LGTM!apps/meteor/app/api/server/helpers/getUserFromParams.ts (1)
13-18: LGTM!apps/meteor/client/views/room/Header/RoomTopic.tsx (1)
4-5: LGTM!Also applies to: 16-16, 19-19, 26-28, 42-44
apps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsx (1)
4-4: LGTM!Also applies to: 10-10, 124-125
apps/meteor/app/notifications/client/lib/Presence.ts (1)
1-1: LGTM!Also applies to: 13-13, 17-25
packages/ddp-client/src/types/streams.ts (1)
235-236: LGTM!Also applies to: 301-314
apps/meteor/tests/end-to-end/api/users.ts (1)
135-140: LGTM!Also applies to: 5144-5144, 5158-5158, 5319-5357
apps/meteor/client/components/UserInfo/UserInfo.tsx (1)
25-25: LGTM!Also applies to: 42-42, 75-75, 108-108
apps/meteor/client/components/UserStatusText/UserStatusText.tsx (1)
1-48: LGTM!apps/meteor/tests/e2e/page-objects/fragments/navbar.ts (1)
247-265: LGTM!
Proposed changes
Adds the frontend for status expiration - UI that consumes
statusSourceandstatusExpiresAtfrom the presence engine. Redesigned Edit Status modal with duration picker, sharedUserStatusTextcomponent for consistent display, and status tooltips across sidebar, members list, user card, and user info.Figma
Changes
UserStatusTextcomponent - shared module with inline display (UserStatusText) and tooltip-only hook (useStatusTooltip), both backed byuseExpirationTextthat formats "Until 6:00 PM" / "Until May 9, 2026"expiresAtto APIstatusSource/statusExpiresAtthrough broadcast, DDP streams, client streamer, presence store, REST endpoints, and user data syncStatus_-prefixed i18n keys, added E2E and client store testsIssue(s)
Steps to test or reproduce
See the use case matrix for the full set of scenarios.
Further comments
Depends on the presence engine backend PR (#40274).
Summary by CodeRabbit
New Features
API / Presence
Tests