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 |
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR adds status expiration support: expands presence types and REST contracts to include statusSource and statusExpiresAt, parses/stores expirations as Dates on the client, forwards expiration through presence notifications, adds formatting and tooltip hooks plus UserStatusText, integrates expiration display across UI components, updates the edit-status modal to set expirations, and adds unit and E2E tests. ChangesStatus Expiration Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 (1)
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.62% 69.55% -0.07%
=============================================================
Files 3323 3331 +8
Lines 123009 123416 +407
Branches 21922 21994 +72
=============================================================
+ Hits 85651 85848 +197
- Misses 34011 34218 +207
- Partials 3347 3350 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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!
807228e to
a62ad69
Compare
21fc0a9 to
2f88830
Compare
a62ad69 to
9ad1e60
Compare
2f88830 to
0c3bcd5
Compare
75684ed to
d29edd2
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
e88cee9 to
c6ebe7e
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts (1)
51-54:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid dynamic RegExp for duration option matching.
Using
new RegExp(duration)makes option selection fragile and can match unintended values. Use exact string matching instead.Suggested fix
async selectDuration(duration: string): Promise<void> { await this.durationSelect.click(); - await this.page!.getByRole('option', { name: new RegExp(duration) }).click(); + await this.page!.getByRole('option', { name: duration, exact: true }).click(); }🤖 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 51 - 54, In selectDuration in edit-status-modal.ts, avoid using new RegExp(duration) when locating the option; change the getByRole('option', { name: ... }) call to use the exact string value (duration) so it matches precisely (e.g., this.page!.getByRole('option', { name: duration })) after ensuring duration is the expected exact label; keep the initial click on durationSelect and then select the option by exact name.
🤖 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.
Duplicate comments:
In `@apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts`:
- Around line 51-54: In selectDuration in edit-status-modal.ts, avoid using new
RegExp(duration) when locating the option; change the getByRole('option', {
name: ... }) call to use the exact string value (duration) so it matches
precisely (e.g., this.page!.getByRole('option', { name: duration })) after
ensuring duration is the expected exact label; keep the initial click on
durationSelect and then select the option by exact name.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 446094ac-f11f-4a22-b8c4-563583ffa482
⛔ Files ignored due to path filters (1)
apps/meteor/client/components/UserInfo/__snapshots__/UserInfo.spec.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (28)
apps/meteor/app/notifications/client/lib/Presence.tsapps/meteor/client/components/UserCard/UserCard.tsxapps/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/navbar/NavBarSettingsToolbar/UserMenu/hooks/useCustomStatusModalHandler.tsxapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/hooks/useStatusItems.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/tests/e2e/page-objects/fragments/modals/edit-status-modal.tsapps/meteor/tests/e2e/page-objects/fragments/navbar.tsapps/meteor/tests/e2e/presence.spec.tspackages/core-typings/src/IUser.tspackages/i18n/src/locales/en.i18n.jsonpackages/rest-typings/src/v1/users.ts
✅ Files skipped from review due to trivial changes (2)
- apps/meteor/client/components/UserStatusText/index.ts
- packages/i18n/src/locales/en.i18n.json
🚧 Files skipped from review as they are similar to previous changes (20)
- apps/meteor/client/lib/presence.spec.ts
- apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx
- apps/meteor/client/components/UserCard/UserCard.tsx
- apps/meteor/client/lib/userStatuses.ts
- apps/meteor/client/components/UserStatusText/useStatusTooltip.tsx
- apps/meteor/client/lib/userData.ts
- apps/meteor/client/sidebar/RoomList/RoomListRow.tsx
- apps/meteor/tests/e2e/presence.spec.ts
- apps/meteor/client/sidebar/RoomList/RoomList.tsx
- apps/meteor/app/notifications/client/lib/Presence.ts
- apps/meteor/client/components/UserInfo/UserInfo.tsx
- packages/core-typings/src/IUser.ts
- apps/meteor/client/components/UserStatusText/useExpirationText.ts
- apps/meteor/client/views/room/contextualBar/RoomMembers/RoomMembersItem.tsx
- apps/meteor/client/components/UserStatusText/UserStatusText.tsx
- apps/meteor/client/views/room/Header/RoomTopic.tsx
- apps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsx
- apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
- apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/EditStatusModal.tsx
- apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/hooks/useStatusItems.tsx
📜 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). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{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/presence.tspackages/rest-typings/src/v1/users.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsxapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/hooks/useCustomStatusModalHandler.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsxapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.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.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/page-objects/fragments/modals/edit-status-modal.ts
🧠 Learnings (9)
📚 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/presence.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/presence.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/presence.tspackages/rest-typings/src/v1/users.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.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/presence.tspackages/rest-typings/src/v1/users.tsapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.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/presence.tspackages/rest-typings/src/v1/users.tsapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsxapps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/hooks/useCustomStatusModalHandler.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsxapps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.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.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/navbar/NavBarSettingsToolbar/UserMenu/hooks/useCustomStatusModalHandler.tsxapps/meteor/client/views/room/UserCard/UserCardWithData.tsx
📚 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.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/page-objects/fragments/modals/edit-status-modal.ts
🪛 ast-grep (0.42.2)
apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts
[warning] 52-52: 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 (6)
apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/hooks/useCustomStatusModalHandler.tsx (1)
1-1: LGTM!Also applies to: 10-10
apps/meteor/client/views/room/UserCard/UserCardWithData.tsx (1)
13-13: LGTM!Also applies to: 49-50, 67-67
apps/meteor/client/navbar/NavBarSettingsToolbar/UserMenu/UserMenuHeader.tsx (1)
2-2: LGTM!Also applies to: 12-12, 16-17
packages/rest-typings/src/v1/users.ts (1)
106-109: LGTM!apps/meteor/client/lib/presence.ts (1)
100-105: LGTM!apps/meteor/tests/e2e/page-objects/fragments/modals/edit-status-modal.ts (1)
10-49: LGTM!Also applies to: 56-92
There was a problem hiding this comment.
1 issue found across 29 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
b3a606b to
3b3d9f1
Compare
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
60879e2 to
450aa1e
Compare
450aa1e to
a7d77c3
Compare
There was a problem hiding this comment.
4 issues found across 35 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Proposed changes
Frontend for status expiration. Consumes
statusSourceandstatusExpiresAtfrom the presence engine.Figma
Changes
Don't clear,30 minutes,1 hour, andChoose date and time. Stays open on save failure; expiration validation errors render inline. SendsexpiresAtto/v1/users.setStatus.expiresAtround-trip as the modal.UserStatusTextsurfaces statusText + "Until …" in user card, user info, and room topic. DM and room-members rows show the same info as a hover tooltip, prefixed with the localized presence ("Online - …").statusSourceandstatusExpiresAtfrom DDP streams.Issue(s)
Steps to test or reproduce
See the use case matrix for the full set of scenarios.
Further comments
Frontend only — backend lives in #40274.