Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
75 changes: 60 additions & 15 deletions src/libs/ReportNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import {Str} from 'expensify-common';
import Onyx from 'react-native-onyx';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import type {LocaleContextProps} from '@components/LocaleContextProvider';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {
Expand All @@ -21,7 +22,6 @@
import type {SelectedParticipant} from '@src/types/onyx/NewGroupChatDraft';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import {convertToDisplayString} from './CurrencyUtils';
import {formatPhoneNumber} from './LocalePhoneNumber';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {translateLocal} from './Localize';
import {getForReportAction, getMovedReportID} from './ModifiedExpenseMessage';
Expand Down Expand Up @@ -113,14 +113,14 @@
let currentUserAccountID: number | undefined;
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;

Onyx.connect({

Check warning on line 116 in src/libs/ReportNameUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
currentUserAccountID = value?.accountID;
},
});

Onyx.connect({

Check warning on line 123 in src/libs/ReportNameUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value;
Expand All @@ -137,7 +137,15 @@
* This function is useful in contexts such as 1:1 direct messages (DMs) or other group chats.
* It limits to a maximum of 5 participants for the title and uses short names unless there is only one participant.
*/
const buildReportNameFromParticipantNames = ({report, personalDetailsList: personalDetailsData}: {report: OnyxEntry<Report>; personalDetailsList?: Partial<PersonalDetailsList>}) =>
const buildReportNameFromParticipantNames = ({
report,
personalDetailsList: personalDetailsData,
formatPhoneNumber,
}: {
report: OnyxEntry<Report>;
personalDetailsList?: Partial<PersonalDetailsList>;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
}) =>
Object.keys(report?.participants ?? {})
.map(Number)
.filter((id) => id !== currentUserAccountID)
Expand Down Expand Up @@ -175,7 +183,13 @@
/**
* Returns the report name if the report is a group chat
*/
function getGroupChatName(participants?: SelectedParticipant[], shouldApplyLimit = false, report?: OnyxEntry<Report>, reportMetadataParam?: OnyxEntry<ReportMetadata>): string | undefined {
function getGroupChatName(
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
participants?: SelectedParticipant[],
shouldApplyLimit = false,
report?: OnyxEntry<Report>,
reportMetadataParam?: OnyxEntry<ReportMetadata>,
): string | undefined {
// If we have a report always try to get the name from the report.
if (report?.reportName) {
return report.reportName;
Expand Down Expand Up @@ -217,7 +231,15 @@
/**
* Get the title for a policy expense chat
*/
function getPolicyExpenseChatName({report, personalDetailsList}: {report: OnyxEntry<Report>; personalDetailsList?: Partial<PersonalDetailsList>}): string | undefined {
function getPolicyExpenseChatName({
report,
personalDetailsList,
formatPhoneNumber,
}: {
report: OnyxEntry<Report>;
personalDetailsList?: Partial<PersonalDetailsList>;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
}): string | undefined {
const ownerAccountID = report?.ownerAccountID;
const personalDetails = ownerAccountID ? personalDetailsList?.[ownerAccountID] : undefined;
const login = personalDetails ? personalDetails.login : null;
Expand All @@ -240,11 +262,13 @@
receiverPolicy,
personalDetails,
policies,
formatPhoneNumber,
}: {
report: OnyxEntry<Report>;
receiverPolicy: OnyxEntry<Policy>;
personalDetails?: Partial<PersonalDetailsList>;
policies?: Policy[];
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
}): string {
const invoiceReceiver = report?.invoiceReceiver;
const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL;
Expand All @@ -266,8 +290,13 @@
return getPolicyName({report, policy: receiverPolicyResolved, policies});
}

function getInvoiceReportName(report: OnyxEntry<Report>, policy?: OnyxEntry<Policy>, invoiceReceiverPolicy?: OnyxEntry<Policy>): string {
const moneyRequestReportName = getMoneyRequestReportName({report, policy, invoiceReceiverPolicy});
function getInvoiceReportName(
report: OnyxEntry<Report>,
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
policy?: OnyxEntry<Policy>,
invoiceReceiverPolicy?: OnyxEntry<Policy>,
): string {
const moneyRequestReportName = getMoneyRequestReportName({report, formatPhoneNumber, policy, invoiceReceiverPolicy});
const oldDotInvoiceName = report?.reportName ?? moneyRequestReportName;
return isNewDotInvoice(report?.chatReportID) ? moneyRequestReportName : oldDotInvoiceName;
}
Expand All @@ -277,7 +306,12 @@
* - Individual - a receiver display name.
* - Policy - a receiver policy name.
*/
function getInvoicePayerName(report: OnyxEntry<Report>, invoiceReceiverPolicy?: OnyxEntry<Policy>, invoiceReceiverPersonalDetail?: PersonalDetails | null): string {
function getInvoicePayerName(
report: OnyxEntry<Report>,
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
invoiceReceiverPolicy?: OnyxEntry<Policy>,
invoiceReceiverPersonalDetail?: PersonalDetails | null,
): string {
const invoiceReceiver = report?.invoiceReceiver;
const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL;

Expand All @@ -292,7 +326,17 @@
/**
* Get the title for an IOU or expense chat which will be showing the payer and the amount
*/
function getMoneyRequestReportName({report, policy, invoiceReceiverPolicy}: {report: OnyxEntry<Report>; policy?: OnyxEntry<Policy>; invoiceReceiverPolicy?: OnyxEntry<Policy>}): string {
function getMoneyRequestReportName({
report,
formatPhoneNumber,
policy,
invoiceReceiverPolicy,
}: {
report: OnyxEntry<Report>;
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
policy?: OnyxEntry<Policy>;
invoiceReceiverPolicy?: OnyxEntry<Policy>;
}): string {
if (report?.reportName && isExpenseReport(report)) {
return report.reportName;
}
Expand All @@ -306,7 +350,7 @@
payerOrApproverName = getPolicyName({report: parentReport ?? report, policy});
} else if (isInvoiceReport(report)) {
const chatReport = getReportOrDraftReport(report?.chatReportID);
payerOrApproverName = getInvoicePayerName(chatReport, invoiceReceiverPolicy);
payerOrApproverName = getInvoicePayerName(chatReport, formatPhoneNumber, invoiceReceiverPolicy);
} else {
payerOrApproverName = getDisplayNameForParticipant({accountID: report?.managerID, formatPhoneNumber}) ?? '';
}
Expand Down Expand Up @@ -601,6 +645,7 @@
}

function computeReportName(
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
report?: Report,
reports?: OnyxCollection<Report>,
policies?: OnyxCollection<Policy>,
Expand Down Expand Up @@ -643,7 +688,7 @@
}

if (isGroupChat(report)) {
return getGroupChatName(undefined, true, report) ?? '';
return getGroupChatName(formatPhoneNumber, undefined, true, report) ?? '';
}

let formattedName: string | undefined;
Expand All @@ -653,12 +698,12 @@
}

if (isPolicyExpenseChat(report)) {
formattedName = getPolicyExpenseChatName({report, personalDetailsList});
formattedName = getPolicyExpenseChatName({report, personalDetailsList, formatPhoneNumber});
}

const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
if (isMoneyRequestReport(report)) {
formattedName = getMoneyRequestReportName({report, policy});
formattedName = getMoneyRequestReportName({report, formatPhoneNumber, policy});
}

if (isInvoiceReport(report)) {
Expand All @@ -669,7 +714,7 @@
chatReceiverPolicyID = (chatReceiver as {policyID: string}).policyID;
}
const invoiceReceiverPolicy = chatReceiverPolicyID ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${chatReceiverPolicyID}`] : undefined;
formattedName = getInvoiceReportName(report, policy, invoiceReceiverPolicy);
formattedName = getInvoiceReportName(report, formatPhoneNumber, policy, invoiceReceiverPolicy);
}

if (isInvoiceRoom(report)) {
Expand All @@ -679,7 +724,7 @@
receiverPolicyID = (receiver as {policyID: string}).policyID;
}
const invoiceReceiverPolicy = receiverPolicyID ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${receiverPolicyID}`] : undefined;
formattedName = getInvoicesChatName({report, receiverPolicy: invoiceReceiverPolicy, personalDetails: personalDetailsList});
formattedName = getInvoicesChatName({report, formatPhoneNumber, receiverPolicy: invoiceReceiverPolicy, personalDetails: personalDetailsList});
}

if (isSelfDM(report)) {
Expand All @@ -695,7 +740,7 @@
}

// Not a room or PolicyExpenseChat, generate title from first 5 other participants
formattedName = buildReportNameFromParticipantNames({report, personalDetailsList});
formattedName = buildReportNameFromParticipantNames({report, personalDetailsList, formatPhoneNumber});

const finalName = formattedName ?? report?.reportName ?? '';

Expand Down
18 changes: 12 additions & 6 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 966 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -971,7 +971,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 974 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -989,7 +989,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 992 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -1001,14 +1001,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1004 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1011 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -1023,7 +1023,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1026 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1061,14 +1061,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 1064 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1071 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -3392,7 +3392,13 @@
* @deprecated Moved to src/libs/ReportNameUtils.ts.
* Use ReportNameUtils.getGroupChatName instead.
*/
function getGroupChatName(participants?: SelectedParticipant[], shouldApplyLimit = false, report?: OnyxEntry<Report>, reportMetadataParam?: OnyxEntry<ReportMetadata>): string | undefined {
function getGroupChatName(
Copy link
Contributor

Choose a reason for hiding this comment

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

@allgandalf Please update the same in ReportNameUtils please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems like a new rule or somethings 😢

formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
participants?: SelectedParticipant[],
shouldApplyLimit = false,
report?: OnyxEntry<Report>,
reportMetadataParam?: OnyxEntry<ReportMetadata>,
): string | undefined {
// If we have a report always try to get the name from the report.
if (report?.reportName) {
return report.reportName;
Expand All @@ -3418,8 +3424,8 @@
return participantAccountIDs
.map(
(participantAccountID, index) =>
getDisplayNameForParticipant({accountID: participantAccountID, shouldUseShortForm: isMultipleParticipantReport, formatPhoneNumber: formatPhoneNumberPhoneUtils}) ||
formatPhoneNumberPhoneUtils(participants?.[index]?.login ?? ''),
getDisplayNameForParticipant({accountID: participantAccountID, shouldUseShortForm: isMultipleParticipantReport, formatPhoneNumber}) ||
formatPhoneNumber(participants?.[index]?.login ?? ''),
)
.sort((first, second) => customCollator.compare(first ?? '', second ?? ''))
.filter(Boolean)
Expand All @@ -3429,7 +3435,7 @@
}
// eslint-disable-next-line @typescript-eslint/no-deprecated
return translateLocal('groupChat.defaultReportName', {
displayName: getDisplayNameForParticipant({accountID: participantAccountIDs.at(0), formatPhoneNumber: formatPhoneNumberPhoneUtils}),
displayName: getDisplayNameForParticipant({accountID: participantAccountIDs.at(0), formatPhoneNumber}),
});
}

Expand Down Expand Up @@ -3654,7 +3660,7 @@
type: CONST.ICON_TYPE_AVATAR,
// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
name: getGroupChatName(undefined, true, report),
name: getGroupChatName(formatPhoneNumberPhoneUtils, undefined, true, report),
};
return [groupChatIcon];
}
Expand Down Expand Up @@ -5997,7 +6003,7 @@
if (isGroupChat(report)) {
// This will be fixed as follow up https://github.com/Expensify/App/pull/75357
// eslint-disable-next-line @typescript-eslint/no-deprecated
return getGroupChatName(undefined, true, report) ?? '';
return getGroupChatName(formatPhoneNumberPhoneUtils, undefined, true, report) ?? '';
}

if (isChatRoom(report)) {
Expand Down
8 changes: 6 additions & 2 deletions src/libs/actions/OnyxDerived/configs/reportAttributes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {OnyxEntry} from 'react-native-onyx';
import {formatPhoneNumberWithCountryCode} from '@libs/LocalePhoneNumber';
import {computeReportName} from '@libs/ReportNameUtils';
import {generateIsEmptyReport, generateReportAttributes, isArchivedReport, isValidReport} from '@libs/ReportUtils';
import SidebarUtils from '@libs/SidebarUtils';
Expand Down Expand Up @@ -63,6 +64,7 @@ export default createOnyxDerivedValueConfig({
dependencies: [
ONYXKEYS.COLLECTION.REPORT,
ONYXKEYS.NVP_PREFERRED_LOCALE,
ONYXKEYS.COUNTRY_CODE,
ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
ONYXKEYS.COLLECTION.REPORT_ACTIONS,
ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
Expand All @@ -72,7 +74,7 @@ export default createOnyxDerivedValueConfig({
ONYXKEYS.COLLECTION.REPORT_METADATA,
],
compute: (
[reports, preferredLocale, transactionViolations, reportActions, reportNameValuePairs, transactions, personalDetails, policies],
[reports, preferredLocale, countryCode, transactionViolations, reportActions, reportNameValuePairs, transactions, personalDetails, policies],
{currentValue, sourceValues, areAllConnectionsSet},
) => {
if (!areAllConnectionsSet) {
Expand All @@ -82,6 +84,8 @@ export default createOnyxDerivedValueConfig({
};
}

const formatPhoneNumber = (phoneNumber: string) => formatPhoneNumberWithCountryCode(phoneNumber, countryCode ?? 1);

// Check if display names changed when personal details are updated
let displayNamesChanged = false;
if (hasKeyTriggeredCompute(ONYXKEYS.PERSONAL_DETAILS_LIST, sourceValues)) {
Expand Down Expand Up @@ -204,7 +208,7 @@ export default createOnyxDerivedValueConfig({
}

acc[report.reportID] = {
reportName: report ? computeReportName(report, reports, policies, transactions, reportNameValuePairs, personalDetails, reportActions) : '',
reportName: report ? computeReportName(formatPhoneNumber, report, reports, policies, transactions, reportNameValuePairs, personalDetails, reportActions) : '',
isEmpty: generateIsEmptyReport(report, isReportArchived),
brickRoadStatus,
requiresAttention,
Expand Down
10 changes: 7 additions & 3 deletions src/pages/GroupChatNameEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {NewChatNavigatorParamList} from '@libs/Navigation/types';
import {getGroupChatDraft, getGroupChatName} from '@libs/ReportUtils';
import {getGroupChatName} from '@libs/ReportNameUtils';
import {getGroupChatDraft} from '@libs/ReportUtils';
import StringUtils from '@libs/StringUtils';
import {setGroupDraft, updateChatName} from '@userActions/Report';
import CONST from '@src/CONST';
Expand All @@ -35,10 +36,13 @@ function GroupChatNameEditPage({report}: GroupChatNameEditPageProps) {
const [groupChatDraft = getGroupChatDraft()] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, {canBeMissing: true});

const styles = useThemeStyles();
const {translate} = useLocalize();
const {translate, formatPhoneNumber} = useLocalize();
const {inputCallbackRef} = useAutoFocusInput();

const existingReportName = useMemo(() => (report ? getGroupChatName(undefined, false, report) : getGroupChatName(groupChatDraft?.participants)), [groupChatDraft?.participants, report]);
const existingReportName = useMemo(
() => (report ? getGroupChatName(formatPhoneNumber, undefined, false, report) : getGroupChatName(formatPhoneNumber, groupChatDraft?.participants)),
[formatPhoneNumber, groupChatDraft?.participants, report],
);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const currentChatName = reportID ? existingReportName : groupChatDraft?.reportName || existingReportName;

Expand Down
5 changes: 3 additions & 2 deletions src/pages/InviteReportParticipantsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import type {ParticipantsNavigatorParamList} from '@libs/Navigation/types';
import {getHeaderMessage} from '@libs/OptionsListUtils';
import {getLoginsByAccountIDs} from '@libs/PersonalDetailsUtils';
import {addSMSDomainIfPhoneNumber, parsePhoneNumber} from '@libs/PhoneNumber';
import {getGroupChatName} from '@libs/ReportNameUtils';
import type {OptionData} from '@libs/ReportUtils';
import {getGroupChatName, getParticipantsAccountIDsForDisplay} from '@libs/ReportUtils';
import {getParticipantsAccountIDsForDisplay} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -123,7 +124,7 @@ function InviteReportParticipantsPage({report}: InviteReportParticipantsPageProp
const validate = useCallback(() => selectedOptions.length > 0, [selectedOptions.length]);

const reportID = report.reportID;
const reportName = useMemo(() => getGroupChatName(undefined, true, report), [report]);
const reportName = useMemo(() => getGroupChatName(formatPhoneNumber, undefined, true, report), [formatPhoneNumber, report]);

const goBack = useCallback(() => {
Navigation.goBack(ROUTES.REPORT_PARTICIPANTS.getRoute(reportID, route.params.backTo));
Expand Down
7 changes: 4 additions & 3 deletions src/pages/NewChatConfirmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import type {CustomRNImageManipulatorResult} from '@libs/cropOrRotateImage/types
import {readFileAsync} from '@libs/fileDownload/FileUtils';
import Navigation from '@libs/Navigation/Navigation';
import {getParticipantsOption} from '@libs/OptionsListUtils';
import {generateReportID, getDefaultGroupAvatar, getGroupChatName} from '@libs/ReportUtils';
import {getGroupChatName} from '@libs/ReportNameUtils';
import {generateReportID, getDefaultGroupAvatar} from '@libs/ReportUtils';
import {navigateToAndOpenReport, setGroupDraft} from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -37,7 +38,7 @@ function navigateToEditChatName() {
function NewChatConfirmPage() {
const optimisticReportID = useRef<string>(generateReportID());
const [avatarFile, setAvatarFile] = useState<File | CustomRNImageManipulatorResult | undefined>();
const {translate, localeCompare} = useLocalize();
const {translate, localeCompare, formatPhoneNumber} = useLocalize();
const styles = useThemeStyles();
const personalData = useCurrentUserPersonalDetails();
const [newGroupDraft, newGroupDraftMetaData] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, {canBeMissing: true});
Expand All @@ -54,7 +55,7 @@ function NewChatConfirmPage() {
return options;
}, [allPersonalDetails, newGroupDraft?.participants]);

const groupName = newGroupDraft?.reportName ? newGroupDraft?.reportName : getGroupChatName(newGroupDraft?.participants);
const groupName = newGroupDraft?.reportName ? newGroupDraft?.reportName : getGroupChatName(formatPhoneNumber, newGroupDraft?.participants);
const selectedParticipants: ListItem[] = useMemo(
() =>
selectedOptions
Expand Down
Loading
Loading