diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 5524f531d43a..777ff5741d12 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -745,10 +745,6 @@ function isReportActionDeprecated(reportAction: OnyxEntry, 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); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4f3a0cf32927..022c616c0742 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6374,47 +6374,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. * @@ -10493,7 +10452,6 @@ export { buildOptimisticMoneyRequestEntities, buildOptimisticMovedReportAction, buildOptimisticChangePolicyReportAction, - buildOptimisticMovedTrackedExpenseModifiedReportAction, buildOptimisticRenamedRoomReportAction, buildOptimisticRoomDescriptionUpdatedReportAction, buildOptimisticReportPreview, diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 9f832b7f171d..c1d085aa3def 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -104,7 +104,7 @@ import { buildOptimisticIOUReportAction, buildOptimisticModifiedExpenseReportAction, buildOptimisticMoneyRequestEntities, - buildOptimisticMovedTrackedExpenseModifiedReportAction, + buildOptimisticMovedTransactionAction, buildOptimisticReportPreview, buildOptimisticResolvedDuplicatesReportAction, buildOptimisticSubmittedReportAction, @@ -4595,13 +4595,13 @@ const getConvertTrackedExpenseInformation = ( failureData?.push(...deleteFailureData); // Build modified expense report action with the transaction changes - const modifiedExpenseReportAction = buildOptimisticMovedTrackedExpenseModifiedReportAction(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({ @@ -4616,7 +4616,7 @@ const getConvertTrackedExpenseInformation = ( key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, value: { [modifiedExpenseReportAction.reportActionID]: { - ...(modifiedExpenseReportAction as OnyxTypes.ReportAction), + ...modifiedExpenseReportAction, errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericEditFailureMessage'), }, }, 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 {