diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index f7a6f10be88e..33ad99f32326 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -287,7 +287,7 @@ function MoneyRequestView({report, parentReport, policyCategories, shouldShowHor IOU.editMoneyOrDistanceRequest(transaction, report.reportID, {billable: value})} + onToggle={(value) => IOU.editMoneyRequest(transaction, report.reportID, {billable: value})} /> )} diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 24ed59aed17d..6347f45549c7 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -687,7 +687,7 @@ function createDistanceRequest(report, participant, comment, created, transactio * @param {Object} [transactionChanges.waypoints] * */ -function updateDistanceRequest(transactionID, transactionThreadReportID, transactionChanges) { +function editDistanceMoneyRequest(transactionID, transactionThreadReportID, transactionChanges) { const optimisticData = []; const successData = []; const failureData = []; @@ -1771,7 +1771,7 @@ function setDraftSplitTransaction(transactionID, transactionChanges = {}) { * @param {Number} transactionThreadReportID * @param {Object} transactionChanges */ -function editMoneyRequest(transactionID, transactionThreadReportID, transactionChanges) { +function editRegularMoneyRequest(transactionID, transactionThreadReportID, transactionChanges) { // STEP 1: Get all collections we're updating const transactionThread = allReports[`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`]; const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]; @@ -1990,11 +1990,11 @@ function editMoneyRequest(transactionID, transactionThreadReportID, transactionC * @param {Number} transactionThreadReportID * @param {Object} transactionChanges */ -function editMoneyOrDistanceRequest(transaction, transactionThreadReportID, transactionChanges) { +function editMoneyRequest(transaction, transactionThreadReportID, transactionChanges) { if (TransactionUtils.isDistanceRequest(transaction)) { - updateDistanceRequest(transaction.transactionID, transactionThreadReportID, transactionChanges); + editDistanceMoneyRequest(transaction.transactionID, transactionThreadReportID, transactionChanges); } else { - editMoneyRequest(transaction.transactionID, transactionThreadReportID, transactionChanges); + editRegularMoneyRequest(transaction.transactionID, transactionThreadReportID, transactionChanges); } } @@ -3007,5 +3007,5 @@ export { replaceReceipt, detachReceipt, getIOUReportID, - editMoneyOrDistanceRequest, + editMoneyRequest, }; diff --git a/src/pages/EditRequestDistancePage.js b/src/pages/EditRequestDistancePage.js index 410f65943a19..375d56935135 100644 --- a/src/pages/EditRequestDistancePage.js +++ b/src/pages/EditRequestDistancePage.js @@ -102,7 +102,7 @@ function EditRequestDistancePage({report, route, transaction, transactionBackup} } transactionWasSaved.current = true; - IOU.editMoneyOrDistanceRequest(transaction, report.reportID, {waypoints}); + IOU.editMoneyRequest(transaction, report.reportID, {waypoints}); // If the client is offline, then the modal can be closed as well (because there are no errors or other feedback to show them // until they come online again and sync with the server). diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index d113059da8fc..95313bea142d 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -119,7 +119,7 @@ function EditRequestPage({report, route, parentReport, policyCategories, policyT // Update the transaction object and close the modal function editMoneyRequest(transactionChanges) { - IOU.editMoneyOrDistanceRequest(transaction, report.reportID, transactionChanges); + IOU.editMoneyRequest(transaction, report.reportID, transactionChanges); Navigation.dismissModal(report.reportID); } diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index c6037ffede25..7d8a8a4202e7 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -1478,7 +1478,7 @@ describe('actions/IOU', () => { return waitForBatchedUpdates(); }) .then(() => { - IOU.editMoneyOrDistanceRequest(transaction, thread.reportID, {amount: 20000, comment: 'Double the amount!'}); + IOU.editMoneyRequest(transaction, thread.reportID, {amount: 20000, comment: 'Double the amount!'}); return waitForBatchedUpdates(); }) .then( @@ -1613,7 +1613,7 @@ describe('actions/IOU', () => { }) .then(() => { fetch.fail(); - IOU.editMoneyOrDistanceRequest(transaction, thread.reportID, {amount: 20000, comment: 'Double the amount!'}); + IOU.editMoneyRequest(transaction, thread.reportID, {amount: 20000, comment: 'Double the amount!'}); return waitForBatchedUpdates(); }) .then(