Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 53003 on room invite sms shown #53240

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4624eb4
fix #53003 on room invite sms shown
Kalydosos Nov 27, 2024
f9927db
generalize the usage of phone number formatting
Kalydosos Nov 28, 2024
079e8c3
generalize the usage of phone number formatting
Kalydosos Nov 28, 2024
b10f5fb
run prettier
Kalydosos Nov 28, 2024
bd015ed
Merge branch 'Expensify:main' into fix-53003-on-room-invite-sms-shown
Kalydosos Nov 28, 2024
423332c
usememo dependency fix
Kalydosos Nov 28, 2024
3e28287
update some tests with no-break space character
Kalydosos Nov 28, 2024
30912b1
lint update
Kalydosos Nov 28, 2024
b004644
lint update
Kalydosos Nov 28, 2024
845de1c
Merge branch 'main' into fix-53003-on-room-invite-sms-shown
Kalydosos Nov 29, 2024
ab4b111
remove an extra formatting
Kalydosos Nov 30, 2024
1c367fe
Merge branch 'Expensify:main' into fix-53003-on-room-invite-sms-shown
Kalydosos Nov 30, 2024
2c3415c
Merge branch 'Expensify:main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 3, 2024
55e9738
update on iou confirmation options
Kalydosos Dec 3, 2024
e308a4b
revert changes on cards
Kalydosos Dec 4, 2024
864293c
migrate some files from withOnyx to useOnyx
Kalydosos Dec 5, 2024
63e30c3
migrate some files from withOnyx to useOnyx
Kalydosos Dec 5, 2024
f0987e0
Merge branch 'Expensify:main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 5, 2024
3b39a32
format phone number and display names
Kalydosos Dec 6, 2024
6d93690
format phone number and display names
Kalydosos Dec 6, 2024
e79c907
format phone number and display names
Kalydosos Dec 6, 2024
3e216f8
use of formatphonenumber
Kalydosos Dec 6, 2024
de3750f
use of formatphonenumber
Kalydosos Dec 6, 2024
e36f20c
use of formatphonenumber
Kalydosos Dec 6, 2024
9c25564
Merge branch 'main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 6, 2024
b05d47b
resolve conflict on profileavatar
Kalydosos Dec 7, 2024
fa48b45
resolve conflict on profileavatar
Kalydosos Dec 7, 2024
21da67d
resolve conflict on profileavatar
Kalydosos Dec 7, 2024
6bdeffb
fix phone number formatting issue
Kalydosos Dec 9, 2024
953d533
Merge branch 'Expensify:main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 9, 2024
b705118
fix phone number formatting issue
Kalydosos Dec 9, 2024
135dde6
Merge branch 'main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 10, 2024
fe38203
Merge branch 'Expensify:main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 10, 2024
8e43fe1
fix phone number formatting issue
Kalydosos Dec 10, 2024
2e8a6ea
Merge branch 'main' into fix-53003-on-room-invite-sms-shown
Kalydosos Dec 11, 2024
d8cf634
fix phone number formatting
Kalydosos Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/ArchivedReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ArchivedReportFooterProps = ArchivedReportFooterOnyxProps & {

function ArchivedReportFooter({report, reportClosedAction, personalDetails = {}}: ArchivedReportFooterProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {formatPhoneNumber, translate} = useLocalize();

const originalMessage = ReportActionsUtils.isClosedAction(reportClosedAction) ? ReportActionsUtils.getOriginalMessage(reportClosedAction) : null;
const archiveReason = originalMessage?.reason ?? CONST.REPORT.ARCHIVE_REASON.DEFAULT;
Expand Down Expand Up @@ -59,8 +59,8 @@ function ArchivedReportFooter({report, reportClosedAction, personalDetails = {}}

const text = shouldRenderHTML
? translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
oldDisplayName: `<strong>${oldDisplayName}</strong>`,
displayName: `<strong>${formatPhoneNumber(displayName)}</strong>`,
oldDisplayName: `<strong>${formatPhoneNumber(oldDisplayName ?? '')}</strong>`,
policyName: `<strong>${policyName}</strong>`,
shouldUseYou: actorPersonalDetails?.accountID === getCurrentUserAccountID(),
})
Expand Down
16 changes: 8 additions & 8 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function getParticipantsOption(participant: ReportUtils.OptionData | Participant
const detail = getPersonalDetailsForAccountIDs([participant.accountID ?? -1], personalDetails)[participant.accountID ?? -1];
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const login = detail?.login || participant.login || '';
const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(detail, LocalePhoneNumber.formatPhoneNumber(login) || participant.text);
const displayName = LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(detail, login || participant.text));

return {
keyForList: String(detail?.accountID),
Expand Down Expand Up @@ -405,7 +405,7 @@ function uniqFast(items: string[]): string[] {
function getLastActorDisplayName(lastActorDetails: Partial<PersonalDetails> | null, hasMultipleParticipants: boolean) {
return hasMultipleParticipants && lastActorDetails && lastActorDetails.accountID !== currentUserAccountID
? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
lastActorDetails.firstName || PersonalDetailsUtils.getDisplayNameOrDefault(lastActorDetails)
lastActorDetails.firstName || LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(lastActorDetails))
: '';
}

Expand Down Expand Up @@ -503,7 +503,7 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails
case CONST.REPORT.ARCHIVE_REASON.REMOVED_FROM_POLICY:
case CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED: {
lastMessageTextFromReport = Localize.translate(preferredLocale, `reportArchiveReasons.${archiveReason}`, {
displayName: PersonalDetailsUtils.getDisplayNameOrDefault(lastActorDetails),
displayName: LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(lastActorDetails)),
policyName: ReportUtils.getPolicyName(report, false, policy),
});
break;
Expand Down Expand Up @@ -1333,20 +1333,20 @@ function getShareLogOptions(options: OptionList, betas: Beta[] = []): Options {
* Build the IOUConfirmation options for showing the payee personalDetail
*/
function getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetail: OnyxEntry<PersonalDetails>, amountText?: string): PayeePersonalDetails {
const formattedLogin = LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? '');
const login = personalDetail?.login ?? '';
return {
text: PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, formattedLogin),
alternateText: formattedLogin || PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, '', false),
text: LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, login)),
alternateText: LocalePhoneNumber.formatPhoneNumber(login || PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, '', false)),
icons: [
{
source: personalDetail?.avatar ?? FallbackAvatar,
name: personalDetail?.login ?? '',
name: LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? ''),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change necessary here? Instead, we can simply use LocalePhoneNumber.formatPhoneNumber directly where the icons.name key is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here, i did a test on spliting expenses and i agree. It will be good if you can also confirm by a visual test

type: CONST.ICON_TYPE_AVATAR,
id: personalDetail?.accountID,
},
],
descriptiveText: amountText ?? '',
login: personalDetail?.login ?? '',
login: LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? ''),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid updating the login here. Instead, we will only update the displayName where it is used to ensure that we do not introduce any regressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i did a test on spliting expenses and i agree. It will be good if you can also confirm by a visual test

accountID: personalDetail?.accountID ?? -1,
keyForList: String(personalDetail?.accountID ?? -1),
};
Expand Down
10 changes: 5 additions & 5 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2156,11 +2156,11 @@ function getDisplayNameForParticipant(

// If the user's personal details (first name) should be hidden, make sure we return "hidden" instead of the short name
if (shouldFallbackToHidden && longName === hiddenTranslation) {
return longName;
return LocalePhoneNumber.formatPhoneNumber(longName);
}

const shortName = personalDetails.firstName ? personalDetails.firstName : longName;
return shouldUseShortForm ? shortName : longName;
return LocalePhoneNumber.formatPhoneNumber(shouldUseShortForm ? shortName : longName);
Copy link
Contributor

Choose a reason for hiding this comment

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

@Kalydosos I am trying to test this change with various users those have phone numbers, but I’m unsure why we need LocalePhoneNumber.formatPhoneNumber here. Each time I log and check, both shortName and longName are already formatted (no SMS and no country code prefix).

Could you let me know if there’s a way to test this specific change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes they are already formatted at that line
Capture d’écran de 2024-12-06 15-56-26

}

function getParticipantsAccountIDsForDisplay(report: OnyxEntry<Report>, shouldExcludeHidden = false, shouldExcludeDeleted = false, shouldForceExcludeCurrentUser = false): number[] {
Expand Down Expand Up @@ -2344,7 +2344,7 @@ function getIcons(
const actorIcon = {
id: actorAccountID,
source: personalDetails?.[actorAccountID ?? -1]?.avatar ?? FallbackAvatar,
name: actorDisplayName,
name: LocalePhoneNumber.formatPhoneNumber(actorDisplayName),
type: CONST.ICON_TYPE_AVATAR,
fallbackIcon: personalDetails?.[parentReportAction?.actorAccountID ?? -1]?.fallbackIcon,
};
Expand Down Expand Up @@ -3804,7 +3804,7 @@ function getInvoicePayerName(report: OnyxEntry<Report>, invoiceReceiverPolicy?:
const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL;

if (isIndividual) {
return PersonalDetailsUtils.getDisplayNameOrDefault(allPersonalDetails?.[invoiceReceiver.accountID]);
return LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(allPersonalDetails?.[invoiceReceiver.accountID]));
}

return getPolicyName(report, false, invoiceReceiverPolicy ?? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${invoiceReceiver?.policyID}`]);
Expand Down Expand Up @@ -3896,7 +3896,7 @@ function getInvoicesChatName(report: OnyxEntry<Report>, receiverPolicy: OnyxEntr
}

if (isIndividual) {
return PersonalDetailsUtils.getDisplayNameOrDefault(allPersonalDetails?.[invoiceReceiverAccountID]);
return LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(allPersonalDetails?.[invoiceReceiverAccountID]));
}

return getPolicyName(report, false, invoiceReceiverPolicy);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ function getAssignee(assigneeAccountID: number, personalDetails: OnyxEntry<OnyxT

return {
icons: ReportUtils.getIconsForParticipants([details.accountID], personalDetails),
displayName: PersonalDetailsUtils.getDisplayNameOrDefault(details),
displayName: LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(details)),
subtitle: details.login ?? '',
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function ProfilePage({route}: ProfilePageProps) {
return {accountID: optimisticAccountID, login: loginParams, displayName: loginParams};
}, [personalDetails, accountID, loginParams, isValidAccountID]);

const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(details, undefined, undefined, isCurrentUser);
const displayName = formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(details, undefined, undefined, isCurrentUser));
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const fallbackIcon = details?.fallbackIcon ?? '';
const login = details?.login ?? '';
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ReportParticipantDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type ReportParticipantDetailsPageProps = WithReportOrNotFoundProps &

function ReportParticipantDetails({personalDetails, report, route}: ReportParticipantDetailsPageProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {formatPhoneNumber, translate} = useLocalize();
const StyleUtils = useStyleUtils();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();

Expand All @@ -54,7 +54,7 @@ function ReportParticipantDetails({personalDetails, report, route}: ReportPartic
const member = report?.participants?.[accountID];
const details = personalDetails?.[accountID] ?? ({} as PersonalDetails);
const fallbackIcon = details.fallbackIcon ?? '';
const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(details);
const displayName = formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(details));
const isCurrentUserAdmin = ReportUtils.isGroupChatAdmin(report, currentUserPersonalDetails?.accountID);
const isSelectedMemberCurrentUser = accountID === currentUserPersonalDetails?.accountID;
const removeUser = useCallback(() => {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/RoomMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import * as Report from '@libs/actions/Report';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {RoomMembersNavigatorParamList} from '@libs/Navigation/types';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
import Navigation from '@navigation/Navigation';
Expand All @@ -33,7 +34,7 @@ type RoomMemberDetailsPagePageProps = WithReportOrNotFoundProps & PlatformStackS

function RoomMemberDetailsPage({report, route}: RoomMemberDetailsPagePageProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {formatPhoneNumber, translate} = useLocalize();
const StyleUtils = useStyleUtils();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
Expand All @@ -47,7 +48,7 @@ function RoomMemberDetailsPage({report, route}: RoomMemberDetailsPagePageProps)
const member = report?.participants?.[accountID];
const details = personalDetails?.[accountID] ?? ({} as PersonalDetails);
const fallbackIcon = details.fallbackIcon ?? '';
const displayName = details.displayName ?? '';
const displayName = formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(details));
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, this is not needed here. We are already using formatPhoneNumber for displayName. Please let me know if there is any case where we explicitly need to apply formatPhoneNumber to the room member's display name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jayeshmangwani i'll check that

Copy link
Contributor

Choose a reason for hiding this comment

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

@Kalydosos Please keep the discussion either here or on Slack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, got it, i was trying not to pollute the PR with questions about your question, got it

Copy link
Contributor

Choose a reason for hiding this comment

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

Haha, no problem! Keeping discussion in one place makes things faster, so 😃 .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will do a new merge with main

Copy link
Contributor Author

@Kalydosos Kalydosos Dec 3, 2024

Choose a reason for hiding this comment

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

@jayeshmangwani i did a test again after the new merge and it's the same result as in the video above

Copy link
Contributor

Choose a reason for hiding this comment

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

@Kalydosos For me, it’s working fine both with and without using the formatPhoneNumber. I’m not sure why we’re getting different results.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Kalydosos Please leave the RoomMemberDetailsPage.tsx page as it is with the changes you’ve made; we’ll figure this out later. However, can you please check the other comments? I feel we shouldn’t make changes in a few places that I’ve highlighted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jayeshmangwani I made a test again for this one and i still have the same result., any change on your side for this ?

const isSelectedMemberCurrentUser = accountID === currentUserPersonalDetails?.accountID;
const isSelectedMemberOwner = accountID === report.ownerAccountID;
const shouldDisableRemoveUser = (ReportUtils.isPolicyExpenseChat(report) && PolicyUtils.isUserPolicyAdmin(policy, details.login)) || isSelectedMemberCurrentUser || isSelectedMemberOwner;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import ControlSelection from '@libs/ControlSelection';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import * as ErrorUtils from '@libs/ErrorUtils';
import focusComposerWithDelay from '@libs/focusComposerWithDelay';
import * as LocalePhoneNumber from '@libs/LocalePhoneNumber';
import ModifiedExpenseMessage from '@libs/ModifiedExpenseMessage';
import Navigation from '@libs/Navigation/Navigation';
import Permissions from '@libs/Permissions';
Expand Down Expand Up @@ -603,7 +604,7 @@ function ReportActionItem({
);
} else if (ReportActionsUtils.isReimbursementQueuedAction(action)) {
const linkedReport = ReportUtils.isChatThread(report) ? parentReport : report;
const submitterDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails[linkedReport?.ownerAccountID ?? -1]);
const submitterDisplayName = LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(personalDetails[linkedReport?.ownerAccountID ?? -1]));
const paymentType = ReportActionsUtils.getOriginalMessage(action)?.paymentType ?? '';

const missingPaymentMethod = ReportUtils.getIndicatedMissingPaymentMethod(userWallet, linkedReport?.reportID ?? '-1', action);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/Profile/ProfileAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {useEffect} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import AttachmentModal from '@components/AttachmentModal';
import * as LocalePhoneNumber from '@libs/LocalePhoneNumber';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {AuthScreensParamList} from '@libs/Navigation/types';
Expand Down Expand Up @@ -37,7 +38,7 @@ function ProfileAvatar({route, personalDetails, personalDetailsMetadata, isLoadi

return (
<AttachmentModal
headerTitle={displayName}
headerTitle={LocalePhoneNumber.formatPhoneNumber(displayName)}
defaultOpen
source={UserUtils.getFullSizeAvatar(avatarURL, accountID)}
onModalClose={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function WorkspaceCompanyCardDetailsPage({route}: WorkspaceCompanyCardDetailsPag
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);
const policy = usePolicy(policyID);
const [isUnassignModalVisible, setIsUnassignModalVisible] = useState(false);
const {translate} = useLocalize();
const {formatPhoneNumber, translate} = useLocalize();
const styles = useThemeStyles();
const theme = useTheme();
const {isOffline} = useNetwork();
Expand All @@ -59,7 +59,7 @@ function WorkspaceCompanyCardDetailsPage({route}: WorkspaceCompanyCardDetailsPag

const cardBank = card?.bank ?? '';
const cardholder = personalDetails?.[card?.accountID ?? -1];
const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(cardholder);
const displayName = formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(cardholder));
const exportMenuItem = getExportMenuItem(connectedIntegration, policyID, translate, policy, card);

const unassignCard = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {View} from 'react-native';
import Avatar from '@components/Avatar';
import Text from '@components/Text';
import useThemeStyles from '@hooks/useThemeStyles';
import * as LocalePhoneNumber from '@libs/LocalePhoneNumber';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import {getDefaultAvatarURL} from '@libs/UserUtils';
import CONST from '@src/CONST';
Expand All @@ -21,7 +22,7 @@ type WorkspaceCompanyCardsListRowProps = {

function WorkspaceCompanyCardsListRow({cardholder, name, cardNumber}: WorkspaceCompanyCardsListRowProps) {
const styles = useThemeStyles();
const cardholderName = useMemo(() => PersonalDetailsUtils.getDisplayNameOrDefault(cardholder), [cardholder]);
const cardholderName = useMemo(() => LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(cardholder)), [cardholder]);

return (
<View style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.br3, styles.p4]}>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/expensifyCard/WorkspaceCardListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import * as LocalePhoneNumber from '@libs/LocalePhoneNumber';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import CONST from '@src/CONST';
import type {PersonalDetails} from '@src/types/onyx';
Expand Down Expand Up @@ -36,7 +37,7 @@ function WorkspaceCardListRow({limit, cardholder, lastFourPAN, name, currency, i
const styles = useThemeStyles();
const {translate} = useLocalize();

const cardholderName = useMemo(() => PersonalDetailsUtils.getDisplayNameOrDefault(cardholder), [cardholder]);
const cardholderName = useMemo(() => LocalePhoneNumber.formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(cardholder)), [cardholder]);
const cardType = isVirtual ? translate('workspace.expensifyCard.virtual') : translate('workspace.expensifyCard.physical');
return (
<View style={[styles.flexRow, styles.gap3, styles.br3, styles.p4]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function WorkspaceExpensifyCardDetailsPage({route}: WorkspaceExpensifyCardDetail

const [isDeactivateModalVisible, setIsDeactivateModalVisible] = useState(false);
const [isOfflineModalVisible, setIsOfflineModalVisible] = useState(false);
const {translate} = useLocalize();
const {formatPhoneNumber, translate} = useLocalize();
// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use the correct modal type for the decision modal
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();
Expand All @@ -55,7 +55,7 @@ function WorkspaceExpensifyCardDetailsPage({route}: WorkspaceExpensifyCardDetail
const isVirtual = !!card?.nameValuePairs?.isVirtual;
const formattedAvailableSpendAmount = CurrencyUtils.convertToDisplayString(card?.availableSpend);
const formattedLimit = CurrencyUtils.convertToDisplayString(card?.nameValuePairs?.unapprovedExpenseLimit);
const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(cardholder);
const displayName = formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(cardholder));
const translationForLimitType = CardUtils.getTranslationKeyForLimitType(card?.nameValuePairs?.limitType);

const fetchCardDetails = useCallback(() => {
Expand Down
Loading
Loading