From e9e8d7232dc374538d0aeacc1573f3fcb0fa53c4 Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Mon, 25 Sep 2023 11:07:56 +0200 Subject: [PATCH] chore: revert pull 27369 changes --- src/libs/actions/IOU.js | 6 +----- src/pages/iou/MoneyRequestDatePage.js | 4 ++-- src/pages/iou/MoneyRequestDescriptionPage.js | 4 ++-- src/pages/iou/MoneyRequestMerchantPage.js | 4 ++-- src/pages/iou/steps/NewRequestAmountPage.js | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 085842af18b9..9f4deee27edc 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -102,9 +102,7 @@ function resetMoneyRequestInfo(id = '') { amount: 0, currency: lodashGet(currentUserPersonalDetails, 'localCurrencyCode', CONST.CURRENCY.USD), comment: '', - // TODO: remove participants after all instances of iou.participants will be replaced with iou.participantAccountIDs participants: [], - participantAccountIDs: [], merchant: CONST.TRANSACTION.DEFAULT_MERCHANT, category: '', tag: '', @@ -2049,9 +2047,7 @@ function setMoneyRequestBillable(billable) { * @param {Object[]} participants */ function setMoneyRequestParticipants(participants) { - // TODO: temporarily we want to save both participants and participantAccountIDs, then we can remove participants (and rename the function) - // more info: https://github.com/Expensify/App/issues/25714#issuecomment-1712924903 and https://github.com/Expensify/App/issues/25714#issuecomment-1716335802 - Onyx.merge(ONYXKEYS.IOU, {participants, participantAccountIDs: _.map(participants, 'accountID')}); + Onyx.merge(ONYXKEYS.IOU, {participants}); } /** diff --git a/src/pages/iou/MoneyRequestDatePage.js b/src/pages/iou/MoneyRequestDatePage.js index e7607277899e..65654aa8098a 100644 --- a/src/pages/iou/MoneyRequestDatePage.js +++ b/src/pages/iou/MoneyRequestDatePage.js @@ -61,10 +61,10 @@ function MoneyRequestDatePage({iou, route, selectedTab}) { IOU.resetMoneyRequestInfo(moneyRequestId); } - if (!isDistanceRequest && (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { + if (!isDistanceRequest && (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } - }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); + }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); function navigateBack() { Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index 8d274a77a19a..6570cffb58d4 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -83,10 +83,10 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { IOU.resetMoneyRequestInfo(moneyRequestId); } - if (!isDistanceRequest && (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { + if (!isDistanceRequest && (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } - }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); + }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); function navigateBack() { Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js index 9d4ce5cc367c..af20930ffe8d 100644 --- a/src/pages/iou/MoneyRequestMerchantPage.js +++ b/src/pages/iou/MoneyRequestMerchantPage.js @@ -58,10 +58,10 @@ function MoneyRequestMerchantPage({iou, route}) { IOU.resetMoneyRequestInfo(moneyRequestId); } - if (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) { + if (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) { Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } - }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID]); + }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID]); function navigateBack() { Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 92bc40a2af51..eb52c634de70 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -115,7 +115,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { IOU.resetMoneyRequestInfo(moneyRequestID); } - if (!isDistanceRequestTab && (_.isEmpty(iou.participantAccountIDs) || iou.amount === 0 || shouldReset)) { + if (!isDistanceRequestTab && (_.isEmpty(iou.participants) || iou.amount === 0 || shouldReset)) { Navigation.goBack(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID), true); } } @@ -123,7 +123,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { return () => { prevMoneyRequestID.current = iou.id; }; - }, [iou.participantAccountIDs, iou.amount, iou.id, isEditing, iouType, reportID, isDistanceRequestTab]); + }, [iou.participants, iou.amount, iou.id, isEditing, iouType, reportID, isDistanceRequestTab]); const navigateBack = () => { Navigation.goBack(isEditing ? ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID) : ROUTES.HOME);