Skip to content

Commit

Permalink
Merge pull request #31911 from 0xmiroslav/fix-31834
Browse files Browse the repository at this point in the history
[CP Staging] revert optimistic receipt errors

(cherry picked from commit edcf8f8)
  • Loading branch information
mountiny authored and OSBotify committed Nov 27, 2023
1 parent c6b70d1 commit 4eeef99
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,6 @@ function resetMoneyRequestInfo(id = '') {
});
}

/**
* Helper function to get the receipt error for money requests, or the generic error if there's no receipt
*
* @param {Object} receipt
* @returns {Object}
*/
function getReceiptError(receipt) {
return _.isEmpty(receipt)
? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage')
: ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: receipt.source, filename: receipt.filename});
}

function buildOnyxDataForMoneyRequest(
chatReport,
iouReport,
Expand Down Expand Up @@ -356,7 +344,7 @@ function buildOnyxDataForMoneyRequest(
...(isNewChatReport
? {
[chatCreatedAction.reportActionID]: {
errors: getReceiptError(transaction.receipt),
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
},
[reportPreviewAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError(null),
Expand All @@ -365,7 +353,7 @@ function buildOnyxDataForMoneyRequest(
: {
[reportPreviewAction.reportActionID]: {
created: reportPreviewAction.created,
errors: getReceiptError(transaction.receipt),
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
},
}),
},
Expand All @@ -377,15 +365,15 @@ function buildOnyxDataForMoneyRequest(
...(isNewIOUReport
? {
[iouCreatedAction.reportActionID]: {
errors: getReceiptError(transaction.receipt),
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
},
[iouAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError(null),
},
}
: {
[iouAction.reportActionID]: {
errors: getReceiptError(transaction.receipt),
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
},
}),
},
Expand Down Expand Up @@ -1445,7 +1433,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${splitChatReport.reportID}`,
value: {
[splitIOUReportAction.reportActionID]: {
errors: getReceiptError(receipt),
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
},
},
});
Expand All @@ -1468,7 +1456,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
errors: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'),
},
[splitIOUReportAction.reportActionID]: {
errors: getReceiptError(receipt),
errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
},
},
},
Expand Down

0 comments on commit 4eeef99

Please sign in to comment.