Skip to content

Commit 96e7179

Browse files
Merge pull request Expensify#82382 from callstack-internal/reports/simplify-computation-2
Follow up: Simplify computation of report name for certain types
2 parents 096d945 + 47afc71 commit 96e7179

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/libs/ReportNameUtils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,7 @@ function computeReportName(
732732
if (!report || !report.reportID) {
733733
return '';
734734
}
735-
const privateIsArchivedValue = privateIsArchived ?? allReportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]?.private_isArchived;
736-
const isArchivedNonExpense = isArchivedNonExpenseReport(report, !!privateIsArchivedValue);
735+
737736
const reportPolicy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
738737
const parentReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`];
739738
const parentReportAction = isThread(report) ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`]?.[report.parentReportActionID] : undefined;
@@ -746,13 +745,15 @@ function computeReportName(
746745
}
747746

748747
if (report?.reportName && report.type === CONST.REPORT.TYPE.EXPENSE) {
749-
return isArchivedNonExpense ? generateArchivedReportName(report?.reportName) : report?.reportName;
748+
return report?.reportName;
750749
}
751750

752751
if (isTaskReport(report)) {
753752
return Parser.htmlToText(report?.reportName ?? '').trim();
754753
}
755754

755+
const privateIsArchivedValue = privateIsArchived ?? allReportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]?.private_isArchived;
756+
756757
// eslint-disable-next-line @typescript-eslint/no-deprecated
757758
const chatThreadReportName = computeChatThreadReportName(translateLocal, !!privateIsArchivedValue, report, reports ?? {}, parentReportAction);
758759
if (chatThreadReportName) {
@@ -818,6 +819,8 @@ function computeReportName(
818819
formattedName = CONST.CONCIERGE_DISPLAY_NAME;
819820
}
820821

822+
const isArchivedNonExpense = isArchivedNonExpenseReport(report, !!privateIsArchivedValue);
823+
821824
if (formattedName) {
822825
return formatReportLastMessageText(isArchivedNonExpense ? generateArchivedReportName(formattedName) : formattedName);
823826
}

0 commit comments

Comments
 (0)