From bf6454d63f7bd28c055d86ec6b255899eca3e7bf Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 4 Nov 2025 02:49:04 +0100 Subject: [PATCH 1/3] deprecate SearchReport --- src/types/onyx/SearchResults.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/SearchResults.ts b/src/types/onyx/SearchResults.ts index d8ceb87a1db05..ed7b5fbcf773f 100644 --- a/src/types/onyx/SearchResults.ts +++ b/src/types/onyx/SearchResults.ts @@ -84,7 +84,10 @@ type SearchPersonalDetails = { /** The action that can be performed for the transaction */ type SearchTransactionAction = ValueOf; -/** Model of report search result */ +/** Model of report search result + * + * @deprecated - Use Report instead + */ type SearchReport = { /** The ID of the report */ reportID: string; From 4ca223d6877db389ac8c561ab8f0c6cc48edd5ee Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 4 Nov 2025 03:28:36 +0100 Subject: [PATCH 2/3] remove SearchReport > accountID --- src/libs/SearchUIUtils.ts | 6 +++--- src/types/onyx/SearchResults.ts | 3 --- tests/unit/Search/SearchUIUtilsTest.ts | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 358727ffe0039..24d9a7d7a7958 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -1447,7 +1447,7 @@ function getReportSections( allActions, keyForList: String(reportItem.reportID), groupedBy: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT, - from: transactions.length > 0 ? data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID] : emptyPersonalDetails, + from: transactions.length > 0 ? data.personalDetailsList[data?.[reportKey as ReportKey]?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID] : emptyPersonalDetails, to: !shouldShowBlankTo && reportItem.managerID ? data.personalDetailsList?.[reportItem.managerID] : emptyPersonalDetails, transactions, ...(reportPendingAction ? {pendingAction: reportPendingAction} : {}), @@ -1495,10 +1495,10 @@ function getReportSections( }; if (reportIDToTransactions[reportKey]?.transactions) { reportIDToTransactions[reportKey].transactions.push(transaction); - reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID]; + reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID]; } else if (reportIDToTransactions[reportKey]) { reportIDToTransactions[reportKey].transactions = [transaction]; - reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.accountID ?? CONST.DEFAULT_NUMBER_ID]; + reportIDToTransactions[reportKey].from = data.personalDetailsList[data?.[reportKey as ReportKey]?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID]; } } } diff --git a/src/types/onyx/SearchResults.ts b/src/types/onyx/SearchResults.ts index ed7b5fbcf773f..ae81349c9e808 100644 --- a/src/types/onyx/SearchResults.ts +++ b/src/types/onyx/SearchResults.ts @@ -110,9 +110,6 @@ type SearchReport = { /** The accountID of the report manager */ managerID?: number; - /** The accountID of the user who created the report */ - accountID?: number; - /** The policyID of the report */ policyID?: string; diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index 5027b2d3cac40..ad15d3e1fab5d 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -2510,7 +2510,6 @@ describe('SearchUIUtils', () => { }, // eslint-disable-next-line @typescript-eslint/naming-convention report_6523565988285061: { - accountID: 2074551, chatReportID: '4128157185472356', created: '2025-05-26 19:49:56', currency: 'USD', From d19c64bcd8f9c994ad9a20fd23c50a08910e4bdd Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 4 Nov 2025 03:41:47 +0100 Subject: [PATCH 3/3] lint --- src/libs/SearchUIUtils.ts | 7 +++++++ src/types/onyx/SearchResults.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 24d9a7d7a7958..0dca7a3863000 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -150,16 +150,22 @@ const taskColumnNamesToSortingProperty = { }; const expenseStatusActionMapping = { + // eslint-disable-next-line @typescript-eslint/no-deprecated [CONST.SEARCH.STATUS.EXPENSE.DRAFTS]: (expenseReport: SearchReport) => expenseReport?.stateNum === CONST.REPORT.STATE_NUM.OPEN && expenseReport.statusNum === CONST.REPORT.STATUS_NUM.OPEN, + // eslint-disable-next-line @typescript-eslint/no-deprecated [CONST.SEARCH.STATUS.EXPENSE.OUTSTANDING]: (expenseReport: SearchReport) => expenseReport?.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && expenseReport.statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED, + // eslint-disable-next-line @typescript-eslint/no-deprecated [CONST.SEARCH.STATUS.EXPENSE.APPROVED]: (expenseReport: SearchReport) => expenseReport?.stateNum === CONST.REPORT.STATE_NUM.APPROVED && expenseReport.statusNum === CONST.REPORT.STATUS_NUM.APPROVED, + // eslint-disable-next-line @typescript-eslint/no-deprecated [CONST.SEARCH.STATUS.EXPENSE.PAID]: (expenseReport: SearchReport) => (expenseReport?.stateNum ?? 0) >= CONST.REPORT.STATE_NUM.APPROVED && expenseReport.statusNum === CONST.REPORT.STATUS_NUM.REIMBURSED, + // eslint-disable-next-line @typescript-eslint/no-deprecated [CONST.SEARCH.STATUS.EXPENSE.DONE]: (expenseReport: SearchReport) => expenseReport?.stateNum === CONST.REPORT.STATE_NUM.APPROVED && expenseReport.statusNum === CONST.REPORT.STATUS_NUM.CLOSED, + // eslint-disable-next-line @typescript-eslint/no-deprecated [CONST.SEARCH.STATUS.EXPENSE.UNREPORTED]: (expenseReport: SearchReport) => !expenseReport, [CONST.SEARCH.STATUS.EXPENSE.ALL]: () => true, }; @@ -883,6 +889,7 @@ function getViolations(data: OnyxTypes.SearchResults['data']): OnyxCollection & Record> & PrefixedRecord> & + // eslint-disable-next-line @typescript-eslint/no-deprecated PrefixedRecord & PrefixedRecord & PrefixedRecord & @@ -582,6 +583,7 @@ export type { SearchTransactionAction, SearchPersonalDetails, SearchDataTypes, + // eslint-disable-next-line @typescript-eslint/no-deprecated SearchReport, SearchReportAction, SearchPolicy,