Skip to content
Merged
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
5 changes: 1 addition & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3671,10 +3671,7 @@ function getMoneyRequestReportName({
policy?: OnyxEntry<Policy> | SearchPolicy;
invoiceReceiverPolicy?: OnyxEntry<Policy> | SearchPolicy;
}): string {
const reportFields = getReportFieldsByPolicyID(report?.policyID);
const titleReportField = Object.values(reportFields ?? {}).find((reportField) => reportField?.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID);

if (titleReportField && report?.reportName && isPaidGroupPolicyExpenseReport(report)) {
if (report?.reportName && isExpenseReport(report)) {
return report.reportName;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Search/SearchUIUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ const reportActionListItems = [
],
reportActionID: 'Admin',
reportID: '123456789',
reportName: 'Unavailable workspace owes $50.00',
reportName: 'Expense Report #123',
},
] as ReportActionListItemType[];

Expand Down Expand Up @@ -913,7 +913,7 @@ describe('SearchUIUtils', () => {
],
reportActionID: 'Admin',
reportID: '123456789',
reportName: 'Unavailable workspace owes $50.00',
reportName: 'Expense Report #123',
},
]);
});
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/SidebarOrderTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ describe('Sidebar', () => {
managerID: 4,
policyName: fakePolicy.name,
policyID: fakeReport.policyID,
reportName: 'Report Name',
total: -10000,
currency: 'USD',
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
Expand Down Expand Up @@ -458,7 +459,7 @@ describe('Sidebar', () => {
const displayNames = screen.queryAllByLabelText(hintText);
expect(displayNames).toHaveLength(4);
expect(displayNames.at(0)).toHaveTextContent(`Email One's expenses`);
expect(displayNames.at(1)).toHaveTextContent('Workspace-Test-001 owes $100.00');
expect(displayNames.at(1)).toHaveTextContent('Report Name');
expect(displayNames.at(2)).toHaveTextContent('Email Three');
expect(displayNames.at(3)).toHaveTextContent('Email Two');
})
Expand Down