Skip to content

Commit

Permalink
chore: revert pull 27369 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Sep 25, 2023
1 parent 284c170 commit e9e8d72
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
6 changes: 1 addition & 5 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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});
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/MoneyRequestDatePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/MoneyRequestDescriptionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/MoneyRequestMerchantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/steps/NewRequestAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ 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);
}
}

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);
Expand Down

0 comments on commit e9e8d72

Please sign in to comment.