@@ -11,7 +11,7 @@ import type {LocaleContextProps} from '@components/LocaleContextProvider';
1111import { getEnabledCategoriesCount } from '@libs/CategoryUtils' ;
1212import filterArrayByMatch from '@libs/filterArrayByMatch' ;
1313import { isReportMessageAttachment } from '@libs/isReportMessageAttachment' ;
14- import { formatPhoneNumber } from '@libs/LocalePhoneNumber' ;
14+ import { formatPhoneNumber as formatPhoneNumberPhoneUtils } from '@libs/LocalePhoneNumber' ;
1515// eslint-disable-next-line @typescript-eslint/no-deprecated
1616import { translateLocal } from '@libs/Localize' ;
1717import { appendCountryCode , getPhoneNumberWithoutSpecialChars } from '@libs/LoginUtils' ;
@@ -364,7 +364,7 @@ function getParticipantsOption(participant: OptionData | Participant, personalDe
364364 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
365365 const login = detail ?. login || participant . login || '' ;
366366 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
367- const displayName = participant ?. displayName || formatPhoneNumber ( getDisplayNameOrDefault ( detail , login || participant . text ) ) ;
367+ const displayName = participant ?. displayName || formatPhoneNumberPhoneUtils ( getDisplayNameOrDefault ( detail , login || participant . text ) ) ;
368368
369369 return {
370370 keyForList : String ( detail ?. accountID ?? login ) ,
@@ -375,7 +375,7 @@ function getParticipantsOption(participant: OptionData | Participant, personalDe
375375 firstName : ( detail ?. firstName || participant . firstName ) ?? '' ,
376376 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
377377 lastName : ( detail ?. lastName || participant . lastName ) ?? '' ,
378- alternateText : formatPhoneNumber ( login ) || displayName ,
378+ alternateText : formatPhoneNumberPhoneUtils ( login ) || displayName ,
379379 icons : [
380380 {
381381 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
@@ -426,7 +426,7 @@ function getLastActorDisplayName(lastActorDetails: Partial<PersonalDetails> | nu
426426
427427 return lastActorDetails . accountID !== currentUserAccountID
428428 ? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
429- lastActorDetails . firstName || formatPhoneNumber ( getDisplayNameOrDefault ( lastActorDetails ) )
429+ lastActorDetails . firstName || formatPhoneNumberPhoneUtils ( getDisplayNameOrDefault ( lastActorDetails ) )
430430 : // eslint-disable-next-line @typescript-eslint/no-deprecated
431431 translateLocal ( 'common.you' ) ;
432432}
@@ -508,7 +508,7 @@ function getAlternateText(
508508
509509 return showChatPreviewLine && formattedLastMessageText
510510 ? formattedLastMessageTextWithPrefix
511- : formatPhoneNumber ( option . participantsList && option . participantsList . length > 0 ? ( option . participantsList . at ( 0 ) ?. login ?? '' ) : '' ) ;
511+ : formatPhoneNumberPhoneUtils ( option . participantsList && option . participantsList . length > 0 ? ( option . participantsList . at ( 0 ) ?. login ?? '' ) : '' ) ;
512512}
513513
514514/**
@@ -629,7 +629,7 @@ function getLastMessageTextForReport({
629629 case CONST . REPORT . ARCHIVE_REASON . POLICY_DELETED : {
630630 // eslint-disable-next-line @typescript-eslint/no-deprecated
631631 lastMessageTextFromReport = translateLocal ( `reportArchiveReasons.${ archiveReason } ` , {
632- displayName : formatPhoneNumber ( getDisplayNameOrDefault ( lastActorDetails ) ) ,
632+ displayName : formatPhoneNumberPhoneUtils ( getDisplayNameOrDefault ( lastActorDetails ) ) ,
633633 policyName : getPolicyName ( { report, policy} ) ,
634634 } ) ;
635635 break ;
@@ -915,13 +915,15 @@ function createOption(
915915 showPersonalDetails && personalDetail ?. login
916916 ? personalDetail . login
917917 : getAlternateText ( result , { showChatPreviewLine, forcePolicyNamePreview} , ! ! result . private_isArchived , lastActorDetails ) ;
918- reportName = showPersonalDetails ? getDisplayNameForParticipant ( { accountID : accountIDs . at ( 0 ) } ) || formatPhoneNumber ( personalDetail ?. login ?? '' ) : getReportName ( report ) ;
918+ reportName = showPersonalDetails
919+ ? getDisplayNameForParticipant ( { accountID : accountIDs . at ( 0 ) , formatPhoneNumber : formatPhoneNumberPhoneUtils } ) || formatPhoneNumberPhoneUtils ( personalDetail ?. login ?? '' )
920+ : getReportName ( report ) ;
919921 } else {
920922 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
921- reportName = getDisplayNameForParticipant ( { accountID : accountIDs . at ( 0 ) } ) || formatPhoneNumber ( personalDetail ?. login ?? '' ) ;
923+ reportName = getDisplayNameForParticipant ( { accountID : accountIDs . at ( 0 ) , formatPhoneNumber : formatPhoneNumberPhoneUtils } ) || formatPhoneNumberPhoneUtils ( personalDetail ?. login ?? '' ) ;
922924 result . keyForList = String ( accountIDs . at ( 0 ) ) ;
923925
924- result . alternateText = formatPhoneNumber ( personalDetails ?. [ accountIDs [ 0 ] ] ?. login ?? '' ) ;
926+ result . alternateText = formatPhoneNumberPhoneUtils ( personalDetails ?. [ accountIDs [ 0 ] ] ?. login ?? '' ) ;
925927 }
926928
927929 // Set core display properties that are used in SearchOption context
@@ -2228,8 +2230,8 @@ function getSearchOptions({
22282230function getIOUConfirmationOptionsFromPayeePersonalDetail ( personalDetail : OnyxEntry < PersonalDetails > , amountText ?: string ) : PayeePersonalDetails {
22292231 const login = personalDetail ?. login ?? '' ;
22302232 return {
2231- text : formatPhoneNumber ( getDisplayNameOrDefault ( personalDetail , login ) ) ,
2232- alternateText : formatPhoneNumber ( login || getDisplayNameOrDefault ( personalDetail , '' , false ) ) ,
2233+ text : formatPhoneNumberPhoneUtils ( getDisplayNameOrDefault ( personalDetail , login ) ) ,
2234+ alternateText : formatPhoneNumberPhoneUtils ( login || getDisplayNameOrDefault ( personalDetail , '' , false ) ) ,
22332235 icons : [
22342236 {
22352237 source : personalDetail ?. avatar ?? FallbackAvatar ,
0 commit comments