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}`,