From de75fdb9223d3a9b5f6ec5a175764a3f7ef628f3 Mon Sep 17 00:00:00 2001 From: Rory Abraham <47436092+roryabraham@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:03:56 -0800 Subject: [PATCH] Revert "Fix/26946: Reset amount when edit waypoint" --- src/CONST.ts | 1 - src/libs/actions/IOU.js | 9 --------- src/libs/actions/Transaction.ts | 4 ---- 3 files changed, 14 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 0c98645511d4..b5563825e016 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1177,7 +1177,6 @@ const CONST = { EXPENSIFY: 'Expensify', VBBA: 'ACH', }, - DEFAULT_AMOUNT: 0, TYPE: { SEND: 'send', SPLIT: 'split', diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 511c299dda54..b999435cc3e7 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -181,14 +181,6 @@ function setMoneyRequestAmount_temporaryForRefactor(transactionID, amount, curre Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount, currency}); } -/** - * Reset the money request amount, discarding the user-provided value. In the case of distance requests, this will effectively re-enable the default behavior of automatic amount calculation. - * @param {String} transactionID - */ -function resetMoneyRequestAmount_temporaryForRefactor(transactionID) { - Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {amount: CONST.IOU.DEFAULT_AMOUNT}); -} - /** * @param {String} transactionID * @param {String} created @@ -3503,5 +3495,4 @@ export { detachReceipt, getIOUReportID, editMoneyRequest, - resetMoneyRequestAmount_temporaryForRefactor, }; diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 951851d72eb3..2132ae1bdc61 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -10,7 +10,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import {RecentWaypoint, Transaction} from '@src/types/onyx'; import {OnyxData} from '@src/types/onyx/Request'; import {WaypointCollection} from '@src/types/onyx/Transaction'; -import * as IOU from './IOU'; let recentWaypoints: RecentWaypoint[] = []; Onyx.connect({ @@ -59,7 +58,6 @@ function addStop(transactionID: string) { } function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoint | null, isDraft = false) { - IOU.resetMoneyRequestAmount_temporaryForRefactor(transactionID); Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION : ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, { comment: { waypoints: { @@ -102,7 +100,6 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp } function removeWaypoint(transaction: Transaction, currentIndex: string, isDraft: boolean) { - IOU.resetMoneyRequestAmount_temporaryForRefactor(transaction.transactionID); // Index comes from the route params and is a string const index = Number(currentIndex); const existingWaypoints = transaction?.comment?.waypoints ?? {}; @@ -243,7 +240,6 @@ function getRouteForDraft(transactionID: string, waypoints: WaypointCollection) * which will replace the existing ones. */ function updateWaypoints(transactionID: string, waypoints: WaypointCollection, isDraft = false): Promise { - IOU.resetMoneyRequestAmount_temporaryForRefactor(transactionID); return Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { waypoints,