diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 358727ffe0039..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 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 +1502,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 d8ceb87a1db05..860cab38bbf2c 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; @@ -107,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; @@ -558,6 +558,7 @@ type SearchResults = { data: PrefixedRecord & 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, 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',