Skip to content

feat: User phone identity lookup for external voice calls#40680

Draft
aleksandernsilva wants to merge 1 commit into
feat/voice-identity-lookupfrom
feat/voice-identity-lookup-user-phones
Draft

feat: User phone identity lookup for external voice calls#40680
aleksandernsilva wants to merge 1 commit into
feat/voice-identity-lookupfrom
feat/voice-identity-lookup-user-phones

Conversation

@aleksandernsilva
Copy link
Copy Markdown
Contributor

@aleksandernsilva aleksandernsilva commented May 25, 2026

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

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 25, 2026

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

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

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 25, 2026

⚠️ No Changeset found

Latest commit: d69914e

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

This PR includes no changesets

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

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

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Important

Review skipped

Draft detected.

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

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e730fb0-31ca-4074-99b5-629153dfbd69

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request adds structured multi-phone number support to Rocket.Chat users. It introduces an IUserPhoneNumber type with number, label, primary, and verified fields, updates database operations to query and persist phones, extends REST API contracts with phone validation, creates a reusable form component for phone management, and wires phone editing into both user account and admin forms. It also refactors VoIP/media-call services to use phone-based user lookup instead of custom-field identity lookups.

Changes

Multi-phone user management

Layer / File(s) Summary
Type definitions and database model
packages/core-typings/src/IUser.ts, packages/model-typings/src/models/IUsersModel.ts, packages/models/src/models/Users.ts
Introduces IUserPhoneNumber interface and adds phones?: IUserPhoneNumber[] to IUser, deprecating the single phone field. Database model gains setPhones(userId, phones) and findOneByPhone(phoneNumber, options) methods with a new sparse index on phones.number.
REST API contracts and validation
packages/rest-typings/src/v1/Ajv.ts, packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts, packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts, packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
Registers basic_phone_number AJV format validator and extends create/update user API types with phones field. Each phone object requires a number matching E.164 format and optionally includes label, primary, and verified fields.
Backend user profile and data persistence
apps/meteor/app/api/server/v1/users.ts, apps/meteor/app/lib/server/functions/getFullUserData.ts, apps/meteor/server/methods/saveUserProfile.ts, apps/meteor/app/lib/server/functions/saveUser/saveUser.ts, apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts
Updates updateOwnBasicInfo to accept phones from request body. Extends getFullUserDataByIdOrUsernameOrImportIdOrEmail to include phones in projection. Adds phones persistence via Users.setPhones(userId, phones) in profile save, user update, and new user creation flows.
PhoneNumberFieldList form component
apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx, apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx, apps/meteor/client/components/PhoneNumberFieldList/index.ts
Introduces reusable React component for managing phone arrays with react-hook-form. Validates E.164 phone format (required), enforces label max length of 50 characters, and provides add/remove buttons. Comprehensive tests cover snapshots, accessibility, rendering, user interactions, and validation scenarios.
Account profile phone management
apps/meteor/client/views/account/profile/getProfileInitialValues.ts, apps/meteor/client/views/account/profile/AccountProfileForm.tsx
Initializes account form phones from user.phones or legacy user.phone field. Wires useFieldArray to manage phone entries and renders PhoneNumberFieldList section. Persists phones when submitting profile updates.
Admin user form phone management
apps/meteor/client/views/admin/users/AdminUserForm.tsx
Extends admin user create/edit form with phone management. Updates UserFormProps type to include phones, initializes from existing user data with fallback to legacy phone, and renders phone management section using PhoneNumberFieldList.
User display and phone normalization
apps/meteor/client/components/UserInfo/UserInfo.tsx, apps/meteor/client/views/admin/users/AdminUserInfoWithData.tsx, apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx, apps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx
Updates UserInfo component to render multiple phones instead of single phone, formatting each with formatPhoneNumber and creating tel: links. Normalizes phone data across views by computing phones array from either new phones field or legacy phone field.
Internationalization for phones
packages/i18n/src/locales/en.i18n.json, packages/i18n/src/locales/pt-BR.i18n.json
Adds English and Portuguese (pt-BR) translation keys: __field__is_invalid (validation error), Label_for_phone__label__ (phone label field), Phone_number_placeholder and Phone_label_placeholder (input examples), Remove_phone__label__ (remove confirmation).

VoIP/media-call refactoring

Layer / File(s) Summary
Settings and interface cleanup
apps/meteor/ee/server/settings/voip.ts, ee/packages/media-calls/src/definition/IMediaCallCastDirector.ts, ee/packages/media-calls/src/definition/IMediaCallServer.ts, ee/packages/media-calls/src/server/getDefaultSettings.ts
Removes custom-field identity lookup settings (VoIP_TeamCollab_SIP_Identity_Lookup_Enabled and Custom_Field_Name) from VoIP configuration. Removes ICastDirectorSettings interface and configure(settings) method from IMediaCallCastDirector. Removes identityLookup configuration from IMediaCallServer.sip and default settings.
CastDirector phone lookup implementation
ee/packages/media-calls/src/server/CastDirector.ts
Replaces custom-field-based findUserByIndentityLookup with phone-based findUserByPhone helper that calls Users.findOneByPhone. Updates buildContactListForExtension to resolve SIP extension users via phone number instead of custom field lookup.
MediaCallServer configuration
ee/packages/media-calls/src/server/MediaCallServer.ts
Simplifies configure(settings) to delegate SIP configuration to SipServerSession and store settings on the instance, replacing prior identity lookup configuration via getCastDirector().configure(...).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

type: feature

Suggested reviewers

  • ricardogarim
  • tassoevan
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The PR title describes phone support for user identity lookup in voice calls, which is the core feature across all changes. The title accurately summarizes the main objective.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aleksandernsilva
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label May 25, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 win

Keep DDP saveUserProfile typing in sync with runtime phones support.

saveUserProfile now accepts settings.phones at runtime, but the @rocket.chat/ddp-client ServerMethods declaration 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 win

Optimize validation: skip format check for empty values.

The valid validator 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 win

Align setPhones typing with clear/unset behavior.

Line 408 currently requires IUserPhoneNumber[], but the model implementation accepts IUser['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

📥 Commits

Reviewing files that changed from the base of the PR and between d8facc2 and bcd4ffe.

📒 Files selected for processing (31)
  • apps/meteor/app/api/server/v1/users.ts
  • apps/meteor/app/lib/server/functions/getFullUserData.ts
  • apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts
  • apps/meteor/app/lib/server/functions/saveUser/saveUser.ts
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx
  • apps/meteor/client/components/PhoneNumberFieldList/index.ts
  • apps/meteor/client/components/UserInfo/UserInfo.tsx
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/views/admin/users/AdminUserInfoWithData.tsx
  • apps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx
  • apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx
  • apps/meteor/ee/server/settings/voip.ts
  • apps/meteor/server/methods/saveUserProfile.ts
  • apps/meteor/server/services/media-call/service.ts
  • ee/packages/media-calls/src/definition/IMediaCallCastDirector.ts
  • ee/packages/media-calls/src/definition/IMediaCallServer.ts
  • ee/packages/media-calls/src/server/CastDirector.ts
  • ee/packages/media-calls/src/server/MediaCallServer.ts
  • ee/packages/media-calls/src/server/getDefaultSettings.ts
  • packages/core-typings/src/IUser.ts
  • packages/i18n/src/locales/en.i18n.json
  • packages/i18n/src/locales/pt-BR.i18n.json
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/models/src/models/Users.ts
  • packages/rest-typings/src/v1/Ajv.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts
  • packages/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.ts
  • apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx
  • apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts
  • apps/meteor/app/lib/server/functions/getFullUserData.ts
  • apps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/app/lib/server/functions/saveUser/saveUser.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/Ajv.ts
  • apps/meteor/app/api/server/v1/users.ts
  • apps/meteor/client/views/admin/users/AdminUserInfoWithData.tsx
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts
  • packages/models/src/models/Users.ts
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/methods/saveUserProfile.ts
  • apps/meteor/client/components/UserInfo/UserInfo.tsx
  • ee/packages/media-calls/src/server/CastDirector.ts
  • apps/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.ts
  • apps/meteor/client/views/account/profile/getProfileInitialValues.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/components/PhoneNumberFieldList/index.ts
  • apps/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.ts
  • apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts
  • apps/meteor/app/lib/server/functions/getFullUserData.ts
  • apps/meteor/app/lib/server/functions/saveUser/saveUser.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/Ajv.ts
  • apps/meteor/app/api/server/v1/users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts
  • packages/models/src/models/Users.ts
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/methods/saveUserProfile.ts
  • ee/packages/media-calls/src/server/CastDirector.ts
  • apps/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.ts
  • apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts
  • apps/meteor/app/lib/server/functions/getFullUserData.ts
  • apps/meteor/app/lib/server/functions/saveUser/saveUser.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/Ajv.ts
  • apps/meteor/app/api/server/v1/users.ts
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts
  • packages/models/src/models/Users.ts
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/methods/saveUserProfile.ts
  • ee/packages/media-calls/src/server/CastDirector.ts
  • apps/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.ts
  • apps/meteor/client/views/room/contextualBar/UserInfo/UserInfoWithData.tsx
  • apps/meteor/app/lib/server/functions/saveUser/saveNewUser.ts
  • apps/meteor/app/lib/server/functions/getFullUserData.ts
  • apps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/app/lib/server/functions/saveUser/saveUser.ts
  • packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts
  • packages/rest-typings/src/v1/Ajv.ts
  • apps/meteor/app/api/server/v1/users.ts
  • apps/meteor/client/views/admin/users/AdminUserInfoWithData.tsx
  • packages/model-typings/src/models/IUsersModel.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts
  • packages/models/src/models/Users.ts
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx
  • packages/core-typings/src/IUser.ts
  • apps/meteor/server/methods/saveUserProfile.ts
  • apps/meteor/client/components/UserInfo/UserInfo.tsx
  • ee/packages/media-calls/src/server/CastDirector.ts
  • apps/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.tsx
  • apps/meteor/client/views/omnichannel/components/outboundMessage/components/TemplatePlaceholderSelector/hooks/useAgentSection.tsx
  • apps/meteor/client/views/account/profile/AccountProfileForm.tsx
  • apps/meteor/client/views/admin/users/AdminUserInfoWithData.tsx
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.tsx
  • apps/meteor/client/views/admin/users/AdminUserForm.tsx
  • apps/meteor/client/components/PhoneNumberFieldList/PhoneNumberFieldList.spec.tsx
  • apps/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.ts
  • packages/rest-typings/src/v1/Ajv.ts
  • packages/rest-typings/src/v1/users/UsersUpdateParamsPOST.ts
  • packages/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.tsx validates phones with /^\+?[1-9]\d{1,14}$/, and the REST API uses the same rule via AJV format basic_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 win

Use a collision-safe key for phone rows.

key={p.number} can collide when two phone entries share the same number, which may cause incorrect row reconciliation. This only becomes safe if upstream guarantees uniqueness of p.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

Comment thread packages/models/src/models/Users.ts
Comment thread packages/rest-typings/src/v1/users/UsersUpdateOwnBasicInfoParamsPOST.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.65%. Comparing base (54a6296) to head (d69914e).

Additional details and impacted files

Impacted file tree graph

@@                      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     
Flag Coverage Δ
e2e 59.15% <ø> (-0.07%) ⬇️
e2e-api 46.80% <ø> (+0.76%) ⬆️
unit 70.45% <ø> (-0.02%) ⬇️

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

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

@aleksandernsilva aleksandernsilva force-pushed the feat/voice-identity-lookup-user-phones branch from 31ed886 to c8ecfc8 Compare May 26, 2026 15:27
@aleksandernsilva aleksandernsilva force-pushed the feat/voice-identity-lookup branch from d8facc2 to 54a6296 Compare May 26, 2026 16:28
@aleksandernsilva aleksandernsilva force-pushed the feat/voice-identity-lookup-user-phones branch from c8ecfc8 to 2a63581 Compare May 26, 2026 16:50
@aleksandernsilva aleksandernsilva changed the title feat: Add phone support to user feat: User phone identity lookup for external voice calls May 26, 2026
@aleksandernsilva aleksandernsilva force-pushed the feat/voice-identity-lookup-user-phones branch from 2a63581 to d69914e Compare May 26, 2026 16:53
@aleksandernsilva
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant