feat: User phone identity lookup for external voice calls#40680
feat: User phone identity lookup for external voice calls#40680aleksandernsilva wants to merge 1 commit into
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 |
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis pull request adds structured multi-phone number support to Rocket.Chat users. It introduces an ChangesMulti-phone user management
VoIP/media-call refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
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. 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/meteor/server/methods/saveUserProfile.ts (1)
211-221:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winKeep DDP
saveUserProfiletyping in sync with runtimephonessupport.
saveUserProfilenow acceptssettings.phonesat runtime, but the@rocket.chat/ddp-clientServerMethodsdeclaration still omits it, forcing typed callers to cast.Suggested fix
interface ServerMethods { saveUserProfile( settings: { email?: string; username?: string; realname?: string; newPassword?: string; statusText?: string; statusType?: string; bio?: string; nickname?: string; + phones?: IUserPhoneNumber[]; }, customFields: Record<string, any>, ...args: unknown[] ): boolean; }🤖 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/server/methods/saveUserProfile.ts` around lines 211 - 221, Update the saveUserProfile typing to include the runtime phones field: add a phones property to the settings parameter type used by saveUserProfile and mirror that same change in the `@rocket.chat/ddp-client` ServerMethods declaration for saveUserProfile so typed callers can pass phones without casting; ensure the phones shape matches the runtime structure (an array of phone objects used by the method) and update any related type aliases or imports referenced by saveUserProfile to keep signatures consistent.
🧹 Nitpick comments (2)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx (1)
46-47: ⚡ Quick winOptimize validation: skip format check for empty values.
The
validvalidator runs even when the field is empty, producing a redundant "invalid format" error alongside the "required" error. While only the first error displays, both validators execute unnecessarily.♻️ Proposed refinement
valid: (value: string) => - E164_PHONE_REGEX.test(value) ? true : t('__field__is_invalid', { field: `${t('Phone_number')} ${index + 1}` }), + !value || E164_PHONE_REGEX.test(value) ? true : t('__field__is_invalid', { field: `${t('Phone_number')} ${index + 1}` }),Apply the same pattern to the label validator if needed.
🤖 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/PhoneNumberFieldList/PhoneNumberFieldList.tsx` around lines 46 - 47, The current validator for the phone field runs E164_PHONE_REGEX.test even when the value is empty, causing redundant format checks alongside required validation; update the valid function in PhoneNumberFieldList (the arrow validator using E164_PHONE_REGEX and t('__field__is_invalid')) to first return true when value is falsy/empty (e.g., if (!value) return true) so format validation is skipped for empty inputs, and apply the same empty-short-circuit pattern to the label validator if it also performs format checks.packages/model-typings/src/models/IUsersModel.ts (1)
408-408: ⚡ Quick winAlign
setPhonestyping with clear/unset behavior.Line 408 currently requires
IUserPhoneNumber[], but the model implementation acceptsIUser['phones']and unsets when absent/empty. Keep the interface contract consistent so callers can clear phone data without casts.Proposed typing fix
- setPhones(userId: string, phones: IUserPhoneNumber[]): Promise<UpdateResult>; + setPhones(userId: string, phones: IUser['phones']): Promise<UpdateResult>;🤖 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 `@packages/model-typings/src/models/IUsersModel.ts` at line 408, The setPhones declaration currently requires IUserPhoneNumber[] but the implementation accepts and unsets using IUser['phones']; update the interface so setPhones(userId: string, phones: IUser['phones']): Promise<UpdateResult> (i.e., allow the same optional/null/empty shape as IUser['phones']) so callers can clear phone data without casts and the model can unset when phones is absent/empty.
🤖 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/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx`:
- Around line 32-36: The code in useAgentSection.tsx currently picks
primaryPhone using user.phones?.[0], which can be wrong when a different phone
has primary: true; update the logic that defines primaryPhone (used by phoneItem
and onSelect) to first search user.phones for the entry with phone.primary ===
true and use its number, falling back to user.phone or the first phone number if
no primary flag is found; keep using formatPhoneNumber(primaryPhone) and the
existing phoneItem.id and onClick behavior unchanged.
In `@packages/models/src/models/Users.ts`:
- Around line 71-72: The phones.number index is non-unique, which makes
findOneByPhone ambiguous; either make phone numbers globally unique by changing
the index on phones.number to a unique (or unique-sparse) index, or modify the
findOneByPhone implementation to deterministically select a single owner by
adding filters such as 'phones.verified': true and 'phones.primary': true (and
create a corresponding compound index like { 'phones.number':1,
'phones.verified':1, 'phones.primary':1 } to support the query). Update the
Users model index definition (currently the phones.number index) and the
findOneByPhone query to use the chosen approach and document conflict behavior.
In `@packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts`:
- Around line 71-85: The request schema currently allows client-controlled
phones[].verified; update the UsersUpdateOwnBasicInfoParamsPOST schema to remove
the verified property from phones (i.e., delete the
phones.items.properties.verified entry) and, in the server flow, ensure
saveUserProfile/Users.setPhones does not persist client-provided verified flags
by stripping or overriding verified before doing the $set (e.g., sanitize the
phones array in saveUserProfile so each phone’s verified is omitted or set
server-side). Ensure additionalProperties remains false and that required/other
phone fields are unchanged.
---
Outside diff comments:
In `@apps/meteor/server/methods/saveUserProfile.ts`:
- Around line 211-221: Update the saveUserProfile typing to include the runtime
phones field: add a phones property to the settings parameter type used by
saveUserProfile and mirror that same change in the `@rocket.chat/ddp-client`
ServerMethods declaration for saveUserProfile so typed callers can pass phones
without casting; ensure the phones shape matches the runtime structure (an array
of phone objects used by the method) and update any related type aliases or
imports referenced by saveUserProfile to keep signatures consistent.
---
Nitpick comments:
In `@apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx`:
- Around line 46-47: The current validator for the phone field runs
E164_PHONE_REGEX.test even when the value is empty, causing redundant format
checks alongside required validation; update the valid function in
PhoneNumberFieldList (the arrow validator using E164_PHONE_REGEX and
t('__field__is_invalid')) to first return true when value is falsy/empty (e.g.,
if (!value) return true) so format validation is skipped for empty inputs, and
apply the same empty-short-circuit pattern to the label validator if it also
performs format checks.
In `@packages/model-typings/src/models/IUsersModel.ts`:
- Line 408: The setPhones declaration currently requires IUserPhoneNumber[] but
the implementation accepts and unsets using IUser['phones']; update the
interface so setPhones(userId: string, phones: IUser['phones']):
Promise<UpdateResult> (i.e., allow the same optional/null/empty shape as
IUser['phones']) so callers can clear phone data without casts and the model can
unset when phones is absent/empty.
🪄 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: 0f65dbe3-78e6-411a-a619-b64eba170eef
📒 Files selected for processing (31)
apps/meteor/app/api/server/v1/users.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/app/lib/server/functions/saveUser/saveNewUser.tsapps/meteor/app/lib/server/functions/saveUser/saveUser.tsapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsxapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsxapps/meteor/client/components/PhoneNumberFieldList/index.tsapps/meteor/client/components/UserInfo/UserInfo.tsxapps/meteor/client/views/account/profile/AccountProfileForm.tsxapps/meteor/client/views/account/profile/getProfileInitialValues.tsapps/meteor/client/views/admin/users/AdminUserForm.tsxapps/meteor/client/views/admin/users/AdminUserInfoWithData.tsxapps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsxapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/ee/server/settings/voip.tsapps/meteor/server/methods/saveUserProfile.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/definition/IMediaCallCastDirector.tsee/packages/media-calls/src/definition/IMediaCallServer.tsee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/server/getDefaultSettings.tspackages/core-typings/src/IUser.tspackages/i18n/src/locales/en.i18n.jsonpackages/i18n/src/locales/pt-BR.i18n.jsonpackages/model-typings/src/models/IUsersModel.tspackages/models/src/models/Users.tspackages/rest-typings/src/v1/Ajv.tspackages/rest-typings/src/v1/users/UserCreateParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
💤 Files with no reviewable changes (6)
- apps/meteor/server/services/media-call/service.ts
- ee/packages/media-calls/src/definition/IMediaCallCastDirector.ts
- ee/packages/media-calls/src/server/MediaCallServer.ts
- ee/packages/media-calls/src/definition/IMediaCallServer.ts
- ee/packages/media-calls/src/server/getDefaultSettings.ts
- apps/meteor/ee/server/settings/voip.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). (5)
- GitHub Check: 🔨 Test Unit / Unit Tests
- GitHub Check: 🔨 Test Storybook / Test Storybook
- GitHub Check: 🔎 Code Check / Code Lint
- GitHub Check: 🔎 Code Check / TypeScript
- GitHub Check: 📦 Meteor Build (coverage)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/components/PhoneNumberFieldList/index.tsapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/app/lib/server/functions/saveUser/saveNewUser.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsxapps/meteor/client/views/account/profile/AccountProfileForm.tsxapps/meteor/app/lib/server/functions/saveUser/saveUser.tspackages/rest-typings/src/v1/users/UserCreateParamsPOST.tspackages/rest-typings/src/v1/Ajv.tsapps/meteor/app/api/server/v1/users.tsapps/meteor/client/views/admin/users/AdminUserInfoWithData.tsxpackages/model-typings/src/models/IUsersModel.tspackages/rest-typings/src/v1/users/UsersUpdateParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.tspackages/models/src/models/Users.tsapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsxapps/meteor/client/views/admin/users/AdminUserForm.tsxapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsxpackages/core-typings/src/IUser.tsapps/meteor/server/methods/saveUserProfile.tsapps/meteor/client/components/UserInfo/UserInfo.tsxee/packages/media-calls/src/server/CastDirector.tsapps/meteor/client/views/account/profile/getProfileInitialValues.ts
🧠 Learnings (13)
📚 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/components/PhoneNumberFieldList/index.tsapps/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/components/PhoneNumberFieldList/index.tsapps/meteor/client/views/account/profile/getProfileInitialValues.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/components/PhoneNumberFieldList/index.tsapps/meteor/app/lib/server/functions/saveUser/saveNewUser.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/app/lib/server/functions/saveUser/saveUser.tspackages/rest-typings/src/v1/users/UserCreateParamsPOST.tspackages/rest-typings/src/v1/Ajv.tsapps/meteor/app/api/server/v1/users.tspackages/model-typings/src/models/IUsersModel.tspackages/rest-typings/src/v1/users/UsersUpdateParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.tspackages/models/src/models/Users.tspackages/core-typings/src/IUser.tsapps/meteor/server/methods/saveUserProfile.tsee/packages/media-calls/src/server/CastDirector.tsapps/meteor/client/views/account/profile/getProfileInitialValues.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/components/PhoneNumberFieldList/index.tsapps/meteor/app/lib/server/functions/saveUser/saveNewUser.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/app/lib/server/functions/saveUser/saveUser.tspackages/rest-typings/src/v1/users/UserCreateParamsPOST.tspackages/rest-typings/src/v1/Ajv.tsapps/meteor/app/api/server/v1/users.tspackages/model-typings/src/models/IUsersModel.tspackages/rest-typings/src/v1/users/UsersUpdateParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.tspackages/models/src/models/Users.tspackages/core-typings/src/IUser.tsapps/meteor/server/methods/saveUserProfile.tsee/packages/media-calls/src/server/CastDirector.tsapps/meteor/client/views/account/profile/getProfileInitialValues.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/components/PhoneNumberFieldList/index.tsapps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/app/lib/server/functions/saveUser/saveNewUser.tsapps/meteor/app/lib/server/functions/getFullUserData.tsapps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsxapps/meteor/client/views/account/profile/AccountProfileForm.tsxapps/meteor/app/lib/server/functions/saveUser/saveUser.tspackages/rest-typings/src/v1/users/UserCreateParamsPOST.tspackages/rest-typings/src/v1/Ajv.tsapps/meteor/app/api/server/v1/users.tsapps/meteor/client/views/admin/users/AdminUserInfoWithData.tsxpackages/model-typings/src/models/IUsersModel.tspackages/rest-typings/src/v1/users/UsersUpdateParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.tspackages/models/src/models/Users.tsapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsxapps/meteor/client/views/admin/users/AdminUserForm.tsxapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsxpackages/core-typings/src/IUser.tsapps/meteor/server/methods/saveUserProfile.tsapps/meteor/client/components/UserInfo/UserInfo.tsxee/packages/media-calls/src/server/CastDirector.tsapps/meteor/client/views/account/profile/getProfileInitialValues.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/room/contextualBar/UserInfo/UserInfoWithData.tsxapps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsxapps/meteor/client/views/account/profile/AccountProfileForm.tsxapps/meteor/client/views/admin/users/AdminUserInfoWithData.tsxapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsxapps/meteor/client/views/admin/users/AdminUserForm.tsxapps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsxapps/meteor/client/components/UserInfo/UserInfo.tsx
📚 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.tspackages/rest-typings/src/v1/Ajv.tspackages/rest-typings/src/v1/users/UsersUpdateParamsPOST.tspackages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.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-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/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx
📚 Learning: 2026-03-09T18:39:14.020Z
Learnt from: Harxhit
Repo: RocketChat/Rocket.Chat PR: 39476
File: apps/meteor/server/methods/addAllUserToRoom.ts:0-0
Timestamp: 2026-03-09T18:39:14.020Z
Learning: When implementing batch processing in server methods, favor a single data pass to collect both the items and any derived fields needed for validation. Use the same dataset for both validation and processing to avoid races between validation and execution, and document the approach in code comments. Apply this pattern to similar Meteor Rocket.Chat server methods under apps/meteor/server/methods to prevent race conditions and ensure consistent batch behavior.
Applied to files:
apps/meteor/server/methods/saveUserProfile.ts
🧬 Code graph analysis (11)
apps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx (1)
apps/meteor/client/lib/formatPhoneNumber.ts (1)
formatPhoneNumber(24-36)
apps/meteor/client/views/account/profile/AccountProfileForm.tsx (2)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx (2)
PhoneNumberFieldList(24-122)PhoneNumberFieldListProps(16-22)apps/meteor/client/views/account/profile/getProfileInitialValues.ts (1)
AccountProfileFormValues(5-17)
packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts (1)
packages/core-typings/src/IUser.ts (1)
IUserPhoneNumber(155-160)
packages/model-typings/src/models/IUsersModel.ts (1)
packages/core-typings/src/IUser.ts (1)
IUserPhoneNumber(155-160)
packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts (1)
packages/core-typings/src/IUser.ts (1)
IUserPhoneNumber(155-160)
packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts (1)
packages/core-typings/src/IUser.ts (1)
IUserPhoneNumber(155-160)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx (1)
apps/meteor/client/components/PhoneNumberFieldList/index.ts (1)
PhoneField(2-2)
apps/meteor/client/views/admin/users/AdminUserForm.tsx (1)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx (3)
PhoneNumberFieldList(24-122)PhoneField(9-14)PhoneNumberFieldListProps(16-22)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx (1)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx (3)
PhoneNumberFieldList(24-122)PhoneField(9-14)PhoneNumberFieldListProps(16-22)
apps/meteor/server/methods/saveUserProfile.ts (1)
packages/core-typings/src/IUser.ts (1)
IUserPhoneNumber(155-160)
apps/meteor/client/components/UserInfo/UserInfo.tsx (1)
apps/meteor/client/lib/formatPhoneNumber.ts (1)
formatPhoneNumber(24-36)
🔇 Additional comments (28)
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx (2)
34-122: LGTM!
7-7: Phone validation intentionally allows an optional “+”
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsxvalidates phones with/^\+?[1-9]\d{1,14}$/, and the REST API uses the same rule via AJV formatbasic_phone_number(packages/rest-typings/src/v1/Ajv.ts). This means the backend accepts phone numbers without a leading+, so the optional+matches current application requirements (it’s “basic_phone_number”, not strict E.164).apps/meteor/client/components/PhoneNumberFieldList/index.ts (1)
1-2: LGTM!apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx (1)
1-209: LGTM!apps/meteor/client/views/account/profile/getProfileInitialValues.ts (1)
1-31: LGTM!apps/meteor/client/views/account/profile/AccountProfileForm.tsx (3)
19-19: LGTM!Also applies to: 24-24, 102-106
108-141: LGTM!
313-326: LGTM!apps/meteor/client/views/admin/users/AdminUserForm.tsx (2)
1-1: LGTM!Also applies to: 34-34, 43-43, 59-59, 89-89, 129-129
534-547: LGTM!ee/packages/media-calls/src/server/CastDirector.ts (1)
7-7: LGTM!Also applies to: 97-100, 154-154
packages/core-typings/src/IUser.ts (1)
155-160: LGTM!Also applies to: 212-216
packages/model-typings/src/models/IUsersModel.ts (1)
4-4: LGTM!Also applies to: 448-448
packages/models/src/models/Users.ts (1)
3067-3070: LGTM!packages/rest-typings/src/v1/Ajv.ts (1)
28-28: LGTM!Also applies to: 34-34
packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts (1)
1-1: LGTM!Also applies to: 23-23, 48-62
packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts (1)
1-1: LGTM!Also applies to: 26-26, 111-125
apps/meteor/app/api/server/v1/users.ts (1)
204-204: LGTM!apps/meteor/app/lib/server/functions/getFullUserData.ts (1)
31-31: LGTM!apps/meteor/server/methods/saveUserProfile.ts (1)
2-2: LGTM!Also applies to: 37-38, 122-124, 240-241
apps/meteor/app/lib/server/functions/saveUser/saveUser.ts (1)
57-57: LGTM!Also applies to: 186-188
apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts (1)
58-60: LGTM!apps/meteor/client/components/UserInfo/UserInfo.tsx (2)
1-1: LGTM!Also applies to: 27-27, 39-39, 68-68, 169-172, 174-184
172-173: ⚡ Quick winUse a collision-safe key for phone rows.
key={p.number}can collide when two phone entries share the samenumber, which may cause incorrect row reconciliation. This only becomes safe if upstream guarantees uniqueness ofp.number(after any normalization/deduping); otherwise use a stable composite key (or preferably a phone-specific id).💡 Proposed fix
- {phones.map((p) => ( - <InfoPanelText key={p.number} display='flex' flexDirection='row' alignItems='center'> + {phones.map((p, index) => ( + <InfoPanelText key={`${p.number}-${p.label ?? ''}-${index}`} display='flex' flexDirection='row' alignItems='center'>apps/meteor/client/views/admin/users/AdminUserInfoWithData.tsx (1)
60-61: LGTM!Also applies to: 75-77, 86-86
apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx (1)
66-67: LGTM!Also applies to: 73-75, 87-87
packages/i18n/src/locales/en.i18n.json (1)
2775-2775: LGTM!Also applies to: 3035-3035, 4165-4166, 4487-4487
packages/i18n/src/locales/pt-BR.i18n.json (1)
2760-2760: LGTM!Also applies to: 3012-3012, 4142-4143, 4465-4465
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/voice-identity-lookup #40680 +/- ##
==============================================================
- Coverage 69.66% 69.65% -0.02%
==============================================================
Files 3340 3340
Lines 123326 123326
Branches 21978 22007 +29
==============================================================
- Hits 85921 85899 -22
- Misses 34054 34062 +8
- Partials 3351 3365 +14
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
31ed886 to
c8ecfc8
Compare
d8facc2 to
54a6296
Compare
c8ecfc8 to
2a63581
Compare
2a63581 to
d69914e
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Proposed changes (including videos or screenshots)
Note
This is work in progress. Some of the commits found here are very likely to be moved to separate PR's
Issue(s)
Steps to test or reproduce
Further comments