diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index add5d4ba042b..9ba342ddda90 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -14,6 +14,7 @@ import * as Policy from '@userActions/Policy'; import * as Wallet from '@userActions/Wallet'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; import {defaultProps, propTypes} from './kycWallPropTypes'; // This component allows us to block various actions by forcing the user to first add a default payment method and successfully make it through our Know Your Customer flow @@ -100,7 +101,10 @@ class KYCWall extends React.Component { Navigation.navigate(this.props.addDebitCardRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { if (ReportUtils.isIOUReport(this.props.iouReport)) { - Policy.createWorkspaceFromIOUPayment(this.props.iouReport); + const policyID = Policy.createWorkspaceFromIOUPayment(this.props.iouReport); + + // Navigate to the bank account set up flow for this specific policy + Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('', policyID)); return; } Navigation.navigate(this.props.addBankAccountRoute); diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0439b7c5adca..8176641b70c9 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -68,7 +68,7 @@ function isDeletedParentAction(reportAction: OnyxEntry): boolean { } function isReversedTransaction(reportAction: OnyxEntry) { - return (reportAction?.message?.[0].isReversedTransaction ?? false) && (reportAction?.childVisibleActionCount ?? 0) > 0; + return (reportAction?.message?.[0]?.isReversedTransaction ?? false) && (reportAction?.childVisibleActionCount ?? 0) > 0; } function isPendingRemove(reportAction: OnyxEntry): boolean { diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index b2cce03c9fe7..efcf23a61e8e 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -16,10 +16,8 @@ import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; -import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; const allPolicies = {}; Onyx.connect({ @@ -1463,6 +1461,14 @@ function buildOptimisticPolicyRecentlyUsedCategories(policyID, category) { return lodashUnion([category], policyRecentlyUsedCategories); } +/** + * This flow is used for bottom up flow converting IOU report to an expense report. When user takes this action, + * we create a Collect type workspace when the person taking the action becomes an owner and an admin, while we + * add a new member to the workspace as an employee and convert the IOU report passed as a param into an expense report. + * + * @param {Object} iouReport + * @returns {String} policyID of the workspace we have created + */ function createWorkspaceFromIOUPayment(iouReport) { // This flow only works for IOU reports if (!ReportUtils.isIOUReport(iouReport)) { @@ -1816,8 +1822,7 @@ function createWorkspaceFromIOUPayment(iouReport) { {optimisticData, successData, failureData}, ); - // Navigate to the bank account set up flow for this specific policy - Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute('', policyID)); + return policyID; } export { diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js index 9781c7c27c8c..4c6603c052a3 100644 --- a/src/pages/home/report/ReportActionItemMessage.js +++ b/src/pages/home/report/ReportActionItemMessage.js @@ -47,8 +47,6 @@ function ReportActionItemMessage(props) { iouMessage = ReportUtils.getReportPreviewMessage(ReportUtils.getReport(iouReportID), props.action); } } -<<<<<<< HEAD -======= const isApprovedOrSubmittedReportAction = _.contains([CONST.REPORT.ACTIONS.TYPE.APPROVED, CONST.REPORT.ACTIONS.TYPE.SUBMITTED], props.action.actionName); @@ -85,7 +83,6 @@ function ReportActionItemMessage(props) { return shouldWrapInText ? {reportActionItemFragments} : reportActionItemFragments; }; ->>>>>>> main return ( {!props.isHidden ? (