From 0d8c282b84258bf708f7449afd92e35f7143d706 Mon Sep 17 00:00:00 2001 From: dmkt9 Date: Mon, 20 Oct 2025 11:58:04 +0700 Subject: [PATCH] =?UTF-8?q?When=20an=20expense=20is=20submitted=20in=20off?= =?UTF-8?q?line=20mode,=20"Submitted"=20system=20message=20doesn=C2=B4t=20?= =?UTF-8?q?appear=20on=20report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/actions/IOU.ts | 70 +++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 0e755df46844..8a1ea5e462a1 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -10722,19 +10722,19 @@ function submitReport( const approvalChain = getApprovalChain(policy, expenseReport); const managerID = getAccountIDsByLogins(approvalChain).at(0); - const optimisticData: OnyxUpdate[] = !isSubmitAndClosePolicy - ? [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, - value: { - [optimisticSubmittedReportAction.reportActionID]: { - ...(optimisticSubmittedReportAction as OnyxTypes.ReportAction), - pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, - }, - }, - }, - { + const optimisticData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, + value: { + [optimisticSubmittedReportAction.reportActionID]: { + ...(optimisticSubmittedReportAction as OnyxTypes.ReportAction), + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }, + }, + }, + !isSubmitAndClosePolicy + ? { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, value: { @@ -10745,10 +10745,8 @@ function submitReport( stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, }, - }, - ] - : [ - { + } + : { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, value: { @@ -10757,7 +10755,7 @@ function submitReport( statusNum: CONST.REPORT.STATUS_NUM.CLOSED, }, }, - ]; + ]; optimisticData.push({ onyxMethod: Onyx.METHOD.MERGE, @@ -10779,17 +10777,15 @@ function submitReport( } const successData: OnyxUpdate[] = []; - if (!isSubmitAndClosePolicy) { - successData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, - value: { - [optimisticSubmittedReportAction.reportActionID]: { - pendingAction: null, - }, + successData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, + value: { + [optimisticSubmittedReportAction.reportActionID]: { + pendingAction: null, }, - }); - } + }, + }); const failureData: OnyxUpdate[] = [ { @@ -10806,17 +10802,15 @@ function submitReport( value: currentNextStep, }, ]; - if (!isSubmitAndClosePolicy) { - failureData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, - value: { - [optimisticSubmittedReportAction.reportActionID]: { - errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.other'), - }, + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, + value: { + [optimisticSubmittedReportAction.reportActionID]: { + errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.other'), }, - }); - } + }, + }); if (parentReport?.reportID) { failureData.push({