Skip to content

Commit 67188e0

Browse files
authored
Merge pull request Expensify#67028 from truph01/fix/65688
fix: Sub-header / Workspace Chat Missing from Report View
2 parents e60ee0e + 501e0d1 commit 67188e0

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/components/AvatarWithDisplayName.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function AvatarWithDisplayName({
190190
const parentReportActionParam = report?.parentReportActionID ? parentReportActions?.[report.parentReportActionID] : undefined;
191191
const title = getReportName(report, undefined, parentReportActionParam, personalDetails, invoiceReceiverPolicy, reportAttributes);
192192
const subtitle = getChatRoomSubtitle(report, {isCreateExpenseFlow: true});
193-
const parentNavigationSubtitleData = getParentNavigationSubtitle(report);
193+
const parentNavigationSubtitleData = getParentNavigationSubtitle(report, policy);
194194
const isMoneyRequestOrReport = isMoneyRequestReport(report) || isMoneyRequest(report) || isTrackExpenseReport(report) || isInvoiceReport(report);
195195
const icons = getIcons(report, personalDetails, null, '', -1, policy, invoiceReceiverPolicy);
196196
const ownerPersonalDetails = getPersonalDetailsForAccountIDs(report?.ownerAccountID ? [report.ownerAccountID] : [], personalDetails);

src/libs/ReportUtils.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5392,14 +5392,29 @@ function getPendingChatMembers(accountIDs: number[], previousPendingChatMembers:
53925392
/**
53935393
* Gets the parent navigation subtitle for the report
53945394
*/
5395-
function getParentNavigationSubtitle(report: OnyxEntry<Report>, invoiceReceiverPolicy?: OnyxEntry<Policy>): ParentNavigationSummaryParams {
5395+
function getParentNavigationSubtitle(report: OnyxEntry<Report>, policy?: Policy): ParentNavigationSummaryParams {
53965396
const parentReport = getParentReport(report);
53975397
if (isEmptyObject(parentReport)) {
5398+
const ownerAccountID = report?.ownerAccountID;
5399+
const personalDetails = ownerAccountID ? allPersonalDetails?.[ownerAccountID] : undefined;
5400+
const login = personalDetails ? personalDetails.login : null;
5401+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
5402+
const reportOwnerDisplayName = getDisplayNameForParticipant({accountID: ownerAccountID, shouldRemoveDomain: true}) || login;
5403+
5404+
if (isExpenseReport(report)) {
5405+
return {
5406+
reportName: translateLocal('workspace.common.policyExpenseChatName', {displayName: reportOwnerDisplayName ?? ''}),
5407+
workspaceName: policy?.name,
5408+
};
5409+
}
5410+
if (isIOUReport(report)) {
5411+
return {reportName: reportOwnerDisplayName ?? ''};
5412+
}
53985413
return {};
53995414
}
54005415

54015416
if (isInvoiceReport(report) || isInvoiceRoom(parentReport)) {
5402-
let reportName = `${getPolicyName({report: parentReport})} & ${getInvoicePayerName(parentReport, invoiceReceiverPolicy)}`;
5417+
let reportName = `${getPolicyName({report: parentReport})} & ${getInvoicePayerName(parentReport)}`;
54035418

54045419
// This will get removed as part of https://github.com/Expensify/App/issues/59961
54055420
// eslint-disable-next-line deprecation/deprecation

0 commit comments

Comments
 (0)