From 88cb0bdd9326cfd1a8960f38b54077dba3c04cc9 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 24 Nov 2023 16:36:03 -0700 Subject: [PATCH] pass optimistic workspaceName as param --- src/libs/ReportUtils.js | 4 ++-- src/libs/actions/Policy.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 2e91a93af7e1..467c1502dd5c 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2748,10 +2748,11 @@ function buildOptimisticApprovedReportAction(amount, currency, expenseReportID) * @param {String} toPolicyID * @param {Number} newParentReportID * @param {Number} movedReportID + * @param {String} policyName * * @returns {Object} */ -function buildOptimisticMovedReportAction(fromPolicyID, toPolicyID, newParentReportID, movedReportID) { +function buildOptimisticMovedReportAction(fromPolicyID, toPolicyID, newParentReportID, movedReportID, policyName) { const originalMessage = { fromPolicyID, toPolicyID, @@ -2759,7 +2760,6 @@ function buildOptimisticMovedReportAction(fromPolicyID, toPolicyID, newParentRep movedReportID, }; - const policyName = getPolicyName(allReports[`${ONYXKEYS.COLLECTION.REPORT}${newParentReportID}`]); const movedActionMessage = [ { html: `moved the report to the ${policyName} workspace`, diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index ebc1cdf9a2e1..b993b4a5dd8b 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -1812,7 +1812,7 @@ function createWorkspaceFromIOUPayment(iouReport) { }); // Create the MOVED report action and add it to the DM chat which indicates to the user where the report has been moved - const movedReportAction = ReportUtils.buildOptimisticMovedReportAction(oldPersonalPolicyID, policyID, memberData.workspaceChatReportID, iouReportID); + const movedReportAction = ReportUtils.buildOptimisticMovedReportAction(oldPersonalPolicyID, policyID, memberData.workspaceChatReportID, iouReportID, workspaceName); optimisticData.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${oldChatReportID}`,