From 9e2ceabe9ec75a465a61c42b1ec53372898306c9 Mon Sep 17 00:00:00 2001 From: Pujan Date: Wed, 3 Jan 2024 21:41:37 +0530 Subject: [PATCH 1/4] iou report action failure data changes --- src/libs/actions/IOU.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index d2dfcb166eeb..f375d0cb52e8 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -922,6 +922,15 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t [updatedReportAction.reportActionID]: updatedReportAction, }, }); + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, + value: { + [updatedReportAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericEditFailureMessage'), + }, + }, + }) // Step 4: Compute the IOU total and update the report preview message (and report header) so LHN amount owed is correct. // Should only update if the transaction matches the currency of the report, else we wait for the update From 83ec5c7660aa630e8d820ae950d9c24a0acc72ab Mon Sep 17 00:00:00 2001 From: Pujan Date: Thu, 4 Jan 2024 15:04:32 +0530 Subject: [PATCH 2/4] prettier fix --- src/libs/actions/IOU.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 3740d379e950..db6aefb84e38 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -930,14 +930,14 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t }, }); failureData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, - value: { - [updatedReportAction.reportActionID]: { - errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericEditFailureMessage'), - }, - }, - }) + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, + value: { + [updatedReportAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericEditFailureMessage'), + }, + }, + }); // Step 4: Compute the IOU total and update the report preview message (and report header) so LHN amount owed is correct. // Should only update if the transaction matches the currency of the report, else we wait for the update From c191e78e71a236bfd27d8c34d645d32e0f0e4753 Mon Sep 17 00:00:00 2001 From: Pujan Date: Thu, 4 Jan 2024 21:33:58 +0530 Subject: [PATCH 3/4] dry for failureData --- src/libs/actions/IOU.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index db6aefb84e38..216b613d4577 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -922,20 +922,14 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t [updatedReportAction.reportActionID]: {pendingAction: null}, }, }); - failureData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, - value: { - [updatedReportAction.reportActionID]: updatedReportAction, - }, - }); failureData.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, value: { [updatedReportAction.reportActionID]: { + ...updatedReportAction, errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericEditFailureMessage'), - }, + } }, }); From 1271e8f320f113577fed2bc91d3818d7fba57b17 Mon Sep 17 00:00:00 2001 From: Pujan Date: Thu, 4 Jan 2024 21:38:43 +0530 Subject: [PATCH 4/4] prettier --- src/libs/actions/IOU.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 216b613d4577..a767722998b8 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -929,7 +929,7 @@ function getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, t [updatedReportAction.reportActionID]: { ...updatedReportAction, errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericEditFailureMessage'), - } + }, }, });