diff --git a/src/components/AvatarWithDisplayName.tsx b/src/components/AvatarWithDisplayName.tsx index 076e2cb9e994..591f22c1abd6 100644 --- a/src/components/AvatarWithDisplayName.tsx +++ b/src/components/AvatarWithDisplayName.tsx @@ -190,7 +190,7 @@ function AvatarWithDisplayName({ const parentReportActionParam = report?.parentReportActionID ? parentReportActions?.[report.parentReportActionID] : undefined; const title = getReportName(report, undefined, parentReportActionParam, personalDetails, invoiceReceiverPolicy, reportAttributes); const subtitle = getChatRoomSubtitle(report, {isCreateExpenseFlow: true}); - const parentNavigationSubtitleData = getParentNavigationSubtitle(report, policy); + const parentNavigationSubtitleData = getParentNavigationSubtitle(report); const isMoneyRequestOrReport = isMoneyRequestReport(report) || isMoneyRequest(report) || isTrackExpenseReport(report) || isInvoiceReport(report); const icons = getIcons(report, personalDetails, null, '', -1, policy, invoiceReceiverPolicy); const ownerPersonalDetails = getPersonalDetailsForAccountIDs(report?.ownerAccountID ? [report.ownerAccountID] : [], personalDetails); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 2d21500a6bd3..97bc649d890e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5403,29 +5403,14 @@ function getPendingChatMembers(accountIDs: number[], previousPendingChatMembers: /** * Gets the parent navigation subtitle for the report */ -function getParentNavigationSubtitle(report: OnyxEntry, policy?: Policy): ParentNavigationSummaryParams { +function getParentNavigationSubtitle(report: OnyxEntry, invoiceReceiverPolicy?: OnyxEntry): ParentNavigationSummaryParams { const parentReport = getParentReport(report); if (isEmptyObject(parentReport)) { - const ownerAccountID = report?.ownerAccountID; - const personalDetails = ownerAccountID ? allPersonalDetails?.[ownerAccountID] : undefined; - const login = personalDetails ? personalDetails.login : null; - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const reportOwnerDisplayName = getDisplayNameForParticipant({accountID: ownerAccountID, shouldRemoveDomain: true}) || login; - - if (isExpenseReport(report)) { - return { - reportName: translateLocal('workspace.common.policyExpenseChatName', {displayName: reportOwnerDisplayName ?? ''}), - workspaceName: policy?.name, - }; - } - if (isIOUReport(report)) { - return {reportName: reportOwnerDisplayName ?? ''}; - } return {}; } if (isInvoiceReport(report) || isInvoiceRoom(parentReport)) { - let reportName = `${getPolicyName({report: parentReport})} & ${getInvoicePayerName(parentReport)}`; + let reportName = `${getPolicyName({report: parentReport})} & ${getInvoicePayerName(parentReport, invoiceReceiverPolicy)}`; // This will get removed as part of https://github.com/Expensify/App/issues/59961 // eslint-disable-next-line deprecation/deprecation