-
Notifications
You must be signed in to change notification settings - Fork 4k
Update Reports page tabs (Expenses, Reports, Chats) to work without optimistic transaction thread reports #68929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
34b0c2f
04bcace
e2ed2e3
7c0b4b8
4efff14
2421c3c
6513896
a2159e7
58ed817
c3a64b9
3ed7bd2
f08c1a2
f720ecd
72f3d23
fa00275
9e9658f
9b1712e
1b18e88
9da1fdf
bbffdeb
d0ac8f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; | |
| import useSearchHighlightAndScroll from '@hooks/useSearchHighlightAndScroll'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import {turnOffMobileSelectionMode, turnOnMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; | ||
| import {openSearch, updateSearchResultsWithTransactionThreadReportID} from '@libs/actions/Search'; | ||
| import {openSearch} from '@libs/actions/Search'; | ||
| import Timing from '@libs/actions/Timing'; | ||
| import {canUseTouchScreen} from '@libs/DeviceCapabilities'; | ||
| import Log from '@libs/Log'; | ||
|
|
@@ -29,6 +29,7 @@ import {getIOUActionForTransactionID, isExportIntegrationAction, isIntegrationMe | |
| import {canEditFieldOfMoneyRequest, isArchivedReport} from '@libs/ReportUtils'; | ||
| import {buildCannedSearchQuery, buildSearchQueryJSON, buildSearchQueryString} from '@libs/SearchQueryUtils'; | ||
| import { | ||
| createAndOpenSearchTransactionThread, | ||
| getColumnsToShow, | ||
| getListItem, | ||
| getSections, | ||
|
|
@@ -52,7 +53,6 @@ import {isOnHold, isTransactionPendingDelete} from '@libs/TransactionUtils'; | |
| import Navigation, {navigationRef} from '@navigation/Navigation'; | ||
| import type {SearchFullscreenNavigatorParamList} from '@navigation/types'; | ||
| import EmptySearchView from '@pages/Search/EmptySearchView'; | ||
| import {createTransactionThreadReport} from '@userActions/Report'; | ||
| import CONST from '@src/CONST'; | ||
| import NAVIGATORS from '@src/NAVIGATORS'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
@@ -595,6 +595,16 @@ function Search({queryJSON, searchResults, onSearchListScroll, contentContainerS | |
| return; | ||
| } | ||
|
|
||
| const isTransactionItem = isTransactionListItemType(item); | ||
| const backTo = Navigation.getActiveRoute(); | ||
|
|
||
| // If we're trying to open a transaction without a transaction thread, let's create the thread and navigate the user | ||
| if (isTransactionItem && item.transactionThreadReportID === CONST.REPORT.UNREPORTED_REPORT_ID) { | ||
| const iouReportAction = getIOUActionForTransactionID(reportActionsArray, item.transactionID); | ||
| createAndOpenSearchTransactionThread(item, iouReportAction, hash, backTo); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| return; | ||
| } | ||
|
|
||
| if (isTransactionMemberGroupListItemType(item)) { | ||
| const newFlatFilters = queryJSON.flatFilters.filter((filter) => filter.key !== CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM); | ||
| newFlatFilters.push({key: CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, filters: [{operator: CONST.SEARCH.SYNTAX_OPERATORS.EQUAL_TO, value: item.accountID}]}); | ||
|
|
@@ -635,7 +645,6 @@ function Search({queryJSON, searchResults, onSearchListScroll, contentContainerS | |
| } | ||
|
|
||
| const isFromSelfDM = item.reportID === CONST.REPORT.UNREPORTED_REPORT_ID; | ||
| const isTransactionItem = isTransactionListItemType(item); | ||
|
|
||
| const reportID = | ||
| isTransactionItem && (!item.isFromOneTransactionReport || isFromSelfDM) && item.transactionThreadReportID !== CONST.REPORT.UNREPORTED_REPORT_ID | ||
|
|
@@ -649,24 +658,11 @@ function Search({queryJSON, searchResults, onSearchListScroll, contentContainerS | |
| Performance.markStart(CONST.TIMING.OPEN_REPORT_SEARCH); | ||
| Timing.start(CONST.TIMING.OPEN_REPORT_SEARCH); | ||
|
|
||
| const backTo = Navigation.getActiveRoute(); | ||
|
|
||
| if (isTransactionGroupListItemType(item)) { | ||
| Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID, backTo})); | ||
| return; | ||
| } | ||
|
|
||
| // If we're trying to open a legacy transaction without a transaction thread, let's create the thread and navigate the user | ||
| if (isTransactionItem && reportID === CONST.REPORT.UNREPORTED_REPORT_ID) { | ||
| const iouReportAction = getIOUActionForTransactionID(reportActionsArray, item.transactionID); | ||
| const transactionThreadReport = createTransactionThreadReport(item.report, iouReportAction); | ||
| if (transactionThreadReport?.reportID) { | ||
| updateSearchResultsWithTransactionThreadReportID(hash, item.transactionID, transactionThreadReport?.reportID); | ||
| } | ||
| Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: transactionThreadReport?.reportID, backTo})); | ||
| return; | ||
| } | ||
|
|
||
| if (isReportActionListItemType(item)) { | ||
| const reportActionID = item.reportActionID; | ||
| Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, reportActionID, backTo})); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a one-transaction report, we also need the money report data to display correctly (i.e., the submit button). More details can be found here: #74142 (comment)