From d3d7b5c13787871034a94506ffee66bbd2362292 Mon Sep 17 00:00:00 2001
From: Carlos Martins <cmartins@expensify.com>
Date: Tue, 22 Apr 2025 16:53:43 -0600
Subject: [PATCH 1/5] rm deprecated actions

---
 src/libs/ReportActionsUtils.ts | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts
index 73b1bd95db23..da9d162b80fd 100644
--- a/src/libs/ReportActionsUtils.ts
+++ b/src/libs/ReportActionsUtils.ts
@@ -745,10 +745,6 @@ function isReportActionDeprecated(reportAction: OnyxEntry<ReportAction>, key: st
         CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED,
         CONST.REPORT.ACTIONS.TYPE.DONATION,
         CONST.REPORT.ACTIONS.TYPE.REIMBURSED,
-
-        // We're temporarily deprecating the actions below since the feature is still WIP and these actions are being shown as duplicated
-        CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
-        CONST.REPORT.ACTIONS.TYPE.MOVED_TRANSACTION,
     ];
     if (deprecatedOldDotReportActions.includes(reportAction.actionName)) {
         Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction);

From d92fef4f457eb535111878038554713ce69d33d1 Mon Sep 17 00:00:00 2001
From: Carlos Martins <cmartins@expensify.com>
Date: Tue, 22 Apr 2025 16:54:30 -0600
Subject: [PATCH 2/5] fix tests

---
 tests/utils/collections/reportActions.ts | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/utils/collections/reportActions.ts b/tests/utils/collections/reportActions.ts
index 21347ad65d27..9a05ba6ad992 100644
--- a/tests/utils/collections/reportActions.ts
+++ b/tests/utils/collections/reportActions.ts
@@ -31,8 +31,6 @@ const deprecatedReportActions: ReportActionName[] = [
     CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED,
     CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED,
     CONST.REPORT.ACTIONS.TYPE.DONATION,
-    CONST.REPORT.ACTIONS.TYPE.MOVED_TRANSACTION,
-    CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
 ] as const;
 
 export default function createRandomReportAction(index: number): ReportAction {

From d15aaea31cc0f5e75b94da581439a46ce5045c19 Mon Sep 17 00:00:00 2001
From: Carlos Martins <cmartins@expensify.com>
Date: Tue, 22 Apr 2025 17:49:07 -0600
Subject: [PATCH 3/5] update action type

---
 src/libs/actions/IOU.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index 4d8938065949..3294caa50f2b 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -105,6 +105,7 @@ import {
     buildOptimisticModifiedExpenseReportAction,
     buildOptimisticMoneyRequestEntities,
     buildOptimisticMovedTrackedExpenseModifiedReportAction,
+    buildOptimisticMovedTransactionAction,
     buildOptimisticReportPreview,
     buildOptimisticResolvedDuplicatesReportAction,
     buildOptimisticSubmittedReportAction,
@@ -4595,7 +4596,7 @@ const getConvertTrackedExpenseInformation = (
     failureData?.push(...deleteFailureData);
 
     // Build modified expense report action with the transaction changes
-    const modifiedExpenseReportAction = buildOptimisticMovedTrackedExpenseModifiedReportAction(transactionThreadReportID, moneyRequestReportID);
+    const modifiedExpenseReportAction = buildOptimisticMovedTransactionAction(transactionThreadReportID, moneyRequestReportID);
 
     optimisticData?.push({
         onyxMethod: Onyx.METHOD.MERGE,

From 63851a0d1aced0fec557fcda690f687580554fd4 Mon Sep 17 00:00:00 2001
From: Carlos Martins <cmartins@expensify.com>
Date: Wed, 23 Apr 2025 13:25:28 -0600
Subject: [PATCH 4/5] generate correct optimistic action

---
 src/libs/ReportUtils.ts | 48 ++++++-----------------------------------
 src/libs/actions/IOU.ts |  7 +++---
 2 files changed, 9 insertions(+), 46 deletions(-)

diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index d5a7e88b7f42..cbe66a8521f5 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -444,6 +444,11 @@ type OptimisticSubmittedReportAction = Pick<
     | 'delegateAccountID'
 >;
 
+type OptimisticMovedTransactionReportAction = Pick<
+    ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.MOVED_TRANSACTION>,
+    'actionName' | 'actorAccountID' | 'adminAccountID' | 'automatic' | 'avatar' | 'isAttachmentOnly' | 'originalMessage' | 'message' | 'person' | 'reportActionID' | 'shouldShow' | 'created' | 'pendingAction' | 'delegateAccountID'
+>;
+
 type OptimisticHoldReportAction = Pick<
     ReportAction,
     'actionName' | 'actorAccountID' | 'automatic' | 'avatar' | 'isAttachmentOnly' | 'originalMessage' | 'message' | 'person' | 'reportActionID' | 'shouldShow' | 'created' | 'pendingAction'
@@ -6370,47 +6375,6 @@ function buildOptimisticDetachReceipt(reportID: string | undefined, transactionI
     };
 }
 
-/**
- * Builds an optimistic modified expense action for a tracked expense move with a randomly generated reportActionID.
- * @param transactionThreadID - The reportID of the transaction thread
- * @param movedToReportID - The reportID of the report the transaction is moved to
- */
-function buildOptimisticMovedTrackedExpenseModifiedReportAction(transactionThreadID: string | undefined, movedToReportID: string | undefined): OptimisticModifiedExpenseReportAction {
-    const delegateAccountDetails = getPersonalDetailByEmail(delegateEmail);
-
-    return {
-        actionName: CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE,
-        actorAccountID: currentUserAccountID,
-        automatic: false,
-        avatar: getCurrentUserAvatar(),
-        created: DateUtils.getDBTime(),
-        isAttachmentOnly: false,
-        message: [
-            {
-                // Currently we are composing the message from the originalMessage and message is only used in OldDot and not in the App
-                text: 'You',
-                style: 'strong',
-                type: CONST.REPORT.MESSAGE.TYPE.TEXT,
-            },
-        ],
-        originalMessage: {
-            movedToReportID,
-        },
-        person: [
-            {
-                style: 'strong',
-                text: currentUserPersonalDetails?.displayName ?? String(currentUserAccountID),
-                type: 'TEXT',
-            },
-        ],
-        pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
-        reportActionID: rand64(),
-        reportID: transactionThreadID,
-        shouldShow: true,
-        delegateAccountID: delegateAccountDetails?.accountID,
-    };
-}
-
 /**
  * Updates a report preview action that exists for an IOU report.
  *
@@ -10473,7 +10437,6 @@ export {
     buildOptimisticMoneyRequestEntities,
     buildOptimisticMovedReportAction,
     buildOptimisticChangePolicyReportAction,
-    buildOptimisticMovedTrackedExpenseModifiedReportAction,
     buildOptimisticRenamedRoomReportAction,
     buildOptimisticRoomDescriptionUpdatedReportAction,
     buildOptimisticReportPreview,
@@ -10829,6 +10792,7 @@ export type {
     OptimisticCreatedReportAction,
     OptimisticIOUReportAction,
     OptimisticTaskReportAction,
+    OptimisticMovedTransactionReportAction,
     OptionData,
     TransactionDetails,
     PartialReportAction,
diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index ca7875325dd7..5bdb535639be 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -104,7 +104,6 @@ import {
     buildOptimisticIOUReportAction,
     buildOptimisticModifiedExpenseReportAction,
     buildOptimisticMoneyRequestEntities,
-    buildOptimisticMovedTrackedExpenseModifiedReportAction,
     buildOptimisticMovedTransactionAction,
     buildOptimisticReportPreview,
     buildOptimisticResolvedDuplicatesReportAction,
@@ -4596,13 +4595,13 @@ const getConvertTrackedExpenseInformation = (
     failureData?.push(...deleteFailureData);
 
     // Build modified expense report action with the transaction changes
-    const modifiedExpenseReportAction = buildOptimisticMovedTransactionAction(transactionThreadReportID, moneyRequestReportID);
+    const modifiedExpenseReportAction = buildOptimisticMovedTransactionAction(transactionThreadReportID, moneyRequestReportID ?? CONST.REPORT.UNREPORTED_REPORTID);
 
     optimisticData?.push({
         onyxMethod: Onyx.METHOD.MERGE,
         key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`,
         value: {
-            [modifiedExpenseReportAction.reportActionID]: modifiedExpenseReportAction as OnyxTypes.ReportAction,
+            [modifiedExpenseReportAction.reportActionID]: modifiedExpenseReportAction,
         },
     });
     successData?.push({
@@ -4617,7 +4616,7 @@ const getConvertTrackedExpenseInformation = (
         key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`,
         value: {
             [modifiedExpenseReportAction.reportActionID]: {
-                ...(modifiedExpenseReportAction as OnyxTypes.ReportAction),
+                ...(modifiedExpenseReportAction),
                 errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericEditFailureMessage'),
             },
         },

From e0a203ef4a89639961521babf9fbc66ec1627208 Mon Sep 17 00:00:00 2001
From: Carlos Martins <cmartins@expensify.com>
Date: Wed, 23 Apr 2025 13:26:34 -0600
Subject: [PATCH 5/5] fix lint

---
 src/libs/ReportUtils.ts | 6 ------
 src/libs/actions/IOU.ts | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index cbe66a8521f5..adc4cf064e99 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -444,11 +444,6 @@ type OptimisticSubmittedReportAction = Pick<
     | 'delegateAccountID'
 >;
 
-type OptimisticMovedTransactionReportAction = Pick<
-    ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.MOVED_TRANSACTION>,
-    'actionName' | 'actorAccountID' | 'adminAccountID' | 'automatic' | 'avatar' | 'isAttachmentOnly' | 'originalMessage' | 'message' | 'person' | 'reportActionID' | 'shouldShow' | 'created' | 'pendingAction' | 'delegateAccountID'
->;
-
 type OptimisticHoldReportAction = Pick<
     ReportAction,
     'actionName' | 'actorAccountID' | 'automatic' | 'avatar' | 'isAttachmentOnly' | 'originalMessage' | 'message' | 'person' | 'reportActionID' | 'shouldShow' | 'created' | 'pendingAction'
@@ -10792,7 +10787,6 @@ export type {
     OptimisticCreatedReportAction,
     OptimisticIOUReportAction,
     OptimisticTaskReportAction,
-    OptimisticMovedTransactionReportAction,
     OptionData,
     TransactionDetails,
     PartialReportAction,
diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index 5bdb535639be..e61d3ab7dc39 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -4616,7 +4616,7 @@ const getConvertTrackedExpenseInformation = (
         key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`,
         value: {
             [modifiedExpenseReportAction.reportActionID]: {
-                ...(modifiedExpenseReportAction),
+                ...modifiedExpenseReportAction,
                 errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericEditFailureMessage'),
             },
         },
