Repository navigation
fix: show correct report field #62592
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
d156bd7
21964e8
5ad6243
06ccc92
e80e224
e5f6540
e8efece
2af2aa3
604be91
5f30834
184d996
a68c698
6ba3a21
efa2d20
2ded881
b9a41a9
adee10e
fc529bf
db06b91
8ab7b16
bf201dc
c59c45e
c217404
9867ecf
b4b4cf0
9e49657
db1e0df
4517fd7
e3d7b17
5f8357d
b3ff211
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 |
|---|---|---|
|
|
@@ -97,6 +97,7 @@ import getStateFromPath from './Navigation/helpers/getStateFromPath'; | |
| import {isFullScreenName} from './Navigation/helpers/isNavigatorName'; | ||
| import {linkingConfig} from './Navigation/linkingConfig'; | ||
| import Navigation, {navigationRef} from './Navigation/Navigation'; | ||
| import type {MoneyRequestNavigatorParamList, ReportsSplitNavigatorParamList} from './Navigation/types'; | ||
| import {rand64} from './NumberUtils'; | ||
| import Parser from './Parser'; | ||
| import {getParsedMessageWithShortMentions} from './ParsingUtils'; | ||
|
|
@@ -9974,18 +9975,24 @@ function isReportOutstanding( | |
| iouReport: OnyxInputOrEntry<Report>, | ||
| policyID: string | undefined, | ||
| reportNameValuePairs: OnyxCollection<ReportNameValuePairs> = allReportNameValuePair, | ||
| allowSubmitted = true, | ||
|
daledah marked this conversation as resolved.
Resolved
|
||
| ): boolean { | ||
| if (!iouReport || isEmptyObject(iouReport)) { | ||
| return false; | ||
| } | ||
| const currentRoute = navigationRef.getCurrentRoute(); | ||
| const params = currentRoute?.params as MoneyRequestNavigatorParamList[typeof SCREENS.MONEY_REQUEST.STEP_CONFIRMATION] | ReportsSplitNavigatorParamList[typeof SCREENS.REPORT]; | ||
| const activeReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${params?.reportID}`]; | ||
| const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]; | ||
| const reportNameValuePair = reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${iouReport.reportID}`]; | ||
| const shouldAllowSubmittedReport = allowSubmitted || isInstantSubmitEnabled(policy) || isProcessingReport(activeReport); | ||
| return ( | ||
| isExpenseReport(iouReport) && | ||
| iouReport?.stateNum !== undefined && | ||
| iouReport?.statusNum !== undefined && | ||
| iouReport?.policyID === policyID && | ||
| iouReport?.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && | ||
| iouReport?.statusNum <= CONST.REPORT.STATUS_NUM.SUBMITTED && | ||
| (shouldAllowSubmittedReport ? iouReport?.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED : iouReport?.stateNum < CONST.REPORT.STATE_NUM.SUBMITTED) && | ||
|
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. Coming from #77661, we should use canAddTransaction to detect whether the report is outstanding |
||
| (shouldAllowSubmittedReport ? iouReport?.statusNum <= CONST.REPORT.STATE_NUM.SUBMITTED : iouReport?.statusNum < CONST.REPORT.STATE_NUM.SUBMITTED) && | ||
| !hasForwardedAction(iouReport.reportID) && | ||
| !isArchivedReport(reportNameValuePair) | ||
| ); | ||
|
|
@@ -10003,6 +10010,7 @@ function getOutstandingReportsForUser( | |
| reportOwnerAccountID: number | undefined, | ||
| reports: OnyxCollection<Report> = allReports, | ||
| reportNameValuePairs: OnyxCollection<ReportNameValuePairs> = allReportNameValuePair, | ||
| allowSubmitted = true, | ||
|
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. the default value of allowSubmitted is different between isReportOutstanding and getOutstandingReportsForUser. Is it intentional? |
||
| ): Array<OnyxEntry<Report>> { | ||
| if (!reports) { | ||
| return []; | ||
|
|
@@ -10011,7 +10019,7 @@ function getOutstandingReportsForUser( | |
| .filter( | ||
| (report) => | ||
| report?.pendingFields?.preview !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && | ||
| isReportOutstanding(report, policyID, reportNameValuePairs) && | ||
| isReportOutstanding(report, policyID, reportNameValuePairs, allowSubmitted) && | ||
| report?.ownerAccountID === reportOwnerAccountID, | ||
| ) | ||
| .sort((a, b) => localeCompare(a?.reportName?.toLowerCase() ?? '', b?.reportName?.toLowerCase() ?? '')); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.