@@ -7,6 +7,7 @@ import type {NullishDeep, OnyxCollection, OnyxCollectionInputValue, OnyxEntry, O
77import Onyx from 'react-native-onyx' ;
88import type { PartialDeep , ValueOf } from 'type-fest' ;
99import type { Emoji } from '@assets/emojis/types' ;
10+ import type { LocaleContextProps } from '@components/LocaleContextProvider' ;
1011import * as ActiveClientManager from '@libs/ActiveClientManager' ;
1112import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL' ;
1213import * as API from '@libs/API' ;
@@ -3703,7 +3704,7 @@ function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = fal
37033704 navigateToMostRecentReport ( report ) ;
37043705}
37053706
3706- function buildInviteToRoomOnyxData ( reportID : string , inviteeEmailsToAccountIDs : InvitedEmailsToAccountIDs ) {
3707+ function buildInviteToRoomOnyxData ( reportID : string , inviteeEmailsToAccountIDs : InvitedEmailsToAccountIDs , formatPhoneNumber : LocaleContextProps [ 'formatPhoneNumber' ] ) {
37073708 const report = allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` ] ;
37083709 const reportMetadata = getReportMetadata ( reportID ) ;
37093710 const isGroupChat = isGroupChatReportUtils ( report ) ;
@@ -3729,7 +3730,7 @@ function buildInviteToRoomOnyxData(reportID: string, inviteeEmailsToAccountIDs:
37293730 { ...report ?. participants } ,
37303731 ) ;
37313732
3732- const newPersonalDetailsOnyxData = PersonalDetailsUtils . getPersonalDetailsOnyxDataForOptimisticUsers ( newLogins , newAccountIDs ) ;
3733+ const newPersonalDetailsOnyxData = PersonalDetailsUtils . getPersonalDetailsOnyxDataForOptimisticUsers ( newLogins , newAccountIDs , formatPhoneNumber ) ;
37333734 const pendingChatMembers = getPendingChatMembers ( inviteeAccountIDs , reportMetadata ?. pendingChatMembers ?? [ ] , CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ) ;
37343735
37353736 const newParticipantAccountCleanUp = newAccountIDs . reduce < Record < number , null > > ( ( participantCleanUp , newAccountID ) => {
@@ -3802,8 +3803,8 @@ function buildInviteToRoomOnyxData(reportID: string, inviteeEmailsToAccountIDs:
38023803}
38033804
38043805/** Invites people to a room */
3805- function inviteToRoom ( reportID : string , inviteeEmailsToAccountIDs : InvitedEmailsToAccountIDs ) {
3806- const { optimisticData, successData, failureData, isGroupChat, inviteeEmails, newAccountIDs} = buildInviteToRoomOnyxData ( reportID , inviteeEmailsToAccountIDs ) ;
3806+ function inviteToRoom ( reportID : string , inviteeEmailsToAccountIDs : InvitedEmailsToAccountIDs , formatPhoneNumber : LocaleContextProps [ 'formatPhoneNumber' ] ) {
3807+ const { optimisticData, successData, failureData, isGroupChat, inviteeEmails, newAccountIDs} = buildInviteToRoomOnyxData ( reportID , inviteeEmailsToAccountIDs , formatPhoneNumber ) ;
38073808
38083809 if ( isGroupChat ) {
38093810 const parameters : InviteToGroupChatParams = {
@@ -3883,8 +3884,8 @@ function updateGroupChatMemberRoles(reportID: string, accountIDList: number[], r
38833884}
38843885
38853886/** Invites people to a group chat */
3886- function inviteToGroupChat ( reportID : string , inviteeEmailsToAccountIDs : InvitedEmailsToAccountIDs ) {
3887- inviteToRoom ( reportID , inviteeEmailsToAccountIDs ) ;
3887+ function inviteToGroupChat ( reportID : string , inviteeEmailsToAccountIDs : InvitedEmailsToAccountIDs , formatPhoneNumber : LocaleContextProps [ 'formatPhoneNumber' ] ) {
3888+ inviteToRoom ( reportID , inviteeEmailsToAccountIDs , formatPhoneNumber ) ;
38883889}
38893890
38903891/** Removes people from a room
@@ -5205,7 +5206,7 @@ function moveIOUReportToPolicy(reportID: string, policyID: string) {
52055206 * @param reportID - The ID of the IOU report to move
52065207 * @param policyID - The ID of the policy to move the report to
52075208 */
5208- function moveIOUReportToPolicyAndInviteSubmitter ( reportID : string , policyID : string ) {
5209+ function moveIOUReportToPolicyAndInviteSubmitter ( reportID : string , policyID : string , formatPhoneNumber : LocaleContextProps [ 'formatPhoneNumber' ] ) {
52095210 const iouReport = allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` ] ;
52105211 // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
52115212 // eslint-disable-next-line deprecation/deprecation
@@ -5247,7 +5248,7 @@ function moveIOUReportToPolicyAndInviteSubmitter(reportID: string, policyID: str
52475248
52485249 // Get personal details onyx data (similar to addMembersToWorkspace)
52495250 const { newAccountIDs, newLogins} = PersonalDetailsUtils . getNewAccountIDsAndLogins ( [ submitterLogin ] , [ submitterAccountID ] ) ;
5250- const newPersonalDetailsOnyxData = PersonalDetailsUtils . getPersonalDetailsOnyxDataForOptimisticUsers ( newLogins , newAccountIDs ) ;
5251+ const newPersonalDetailsOnyxData = PersonalDetailsUtils . getPersonalDetailsOnyxDataForOptimisticUsers ( newLogins , newAccountIDs , formatPhoneNumber ) ;
52515252
52525253 // Build announce room members data for the new member
52535254 const announceRoomMembers = buildRoomMembersOnyxData ( CONST . REPORT . CHAT_TYPE . POLICY_ANNOUNCE , policyID , [ submitterAccountID ] ) ;
@@ -5769,7 +5770,7 @@ function changeReportPolicy(report: Report, policyID: string, reportNextStep?: R
57695770/**
57705771 * Invites the submitter to the new report policy, changes the policy of a report and all its child reports, and moves the report to the new policy's expense chat
57715772 */
5772- function changeReportPolicyAndInviteSubmitter ( report : Report , policyID : string , employeeList : PolicyEmployeeList | undefined ) {
5773+ function changeReportPolicyAndInviteSubmitter ( report : Report , policyID : string , employeeList : PolicyEmployeeList | undefined , formatPhoneNumber : LocaleContextProps [ 'formatPhoneNumber' ] ) {
57735774 if ( ! report . reportID || ! policyID || report . policyID === policyID || ! isExpenseReport ( report ) || ! report . ownerAccountID ) {
57745775 return ;
57755776 }
@@ -5785,6 +5786,7 @@ function changeReportPolicyAndInviteSubmitter(report: Report, policyID: string,
57855786 policyID ,
57865787 policyMemberAccountIDs ,
57875788 CONST . POLICY . ROLE . USER ,
5789+ formatPhoneNumber ,
57885790 ) ;
57895791 const optimisticPolicyExpenseChatReportID = membersChats . reportCreationData [ submitterEmail ] . reportID ;
57905792 const optimisticPolicyExpenseChatCreatedReportActionID = membersChats . reportCreationData [ submitterEmail ] . reportActionID ;
0 commit comments