From 0ccfd254569a0af0e6ac0cefcc9a729044c11772 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 23 Sep 2025 11:02:48 +0700 Subject: [PATCH 1/2] fix: Moved expense to personal space seen on admin side --- src/libs/actions/Transaction.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index daa1fedd0f3a..82a19f752c9c 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -47,6 +47,7 @@ import type {WaypointCollection} from '@src/types/onyx/Transaction'; import type TransactionState from '@src/types/utils/TransactionStateType'; import {getPolicyCategoriesData} from './Policy/Category'; import {getPolicyTagsData} from './Policy/Tag'; +import {getCurrentUserAccountID} from './Report'; let recentWaypoints: RecentWaypoint[] = []; Onyx.connect({ @@ -635,6 +636,7 @@ function changeTransactionsReport( const existingSelfDMReportID = findSelfDMReportID(); let selfDMReport: Report; let selfDMCreatedReportAction: ReportAction; + const currentUserAccountID = getCurrentUserAccountID(); if (!existingSelfDMReportID && reportID === CONST.REPORT.UNREPORTED_REPORT_ID) { const currentTime = DateUtils.getDBTime(); @@ -953,6 +955,7 @@ function changeTransactionsReport( parentReportID: targetReportID, parentReportActionID: optimisticMoneyRequestReportActionID, policyID: reportID !== CONST.REPORT.UNREPORTED_REPORT_ID && newReport ? newReport.policyID : CONST.POLICY.ID_FAKE, + ...(isUnreported ? {participants: {[currentUserAccountID]: {notificationPreference: ''}}} : {}), }, }); From 0052c820c0c017f76d27e6276d0ca14f0930872f Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 21 Nov 2025 16:08:39 +0700 Subject: [PATCH 2/2] update participant for manage card transaction --- src/libs/actions/Transaction.ts | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index b968759f007d..7469c6d515f7 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -28,7 +28,7 @@ import { hasViolations as hasViolationsReportUtils, shouldEnableNegative, } from '@libs/ReportUtils'; -import {isOnHold, waypointHasValidAddress} from '@libs/TransactionUtils'; +import {isManagedCardTransaction, isOnHold, waypointHasValidAddress} from '@libs/TransactionUtils'; import ViolationsUtils from '@libs/Violations/ViolationsUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -1053,17 +1053,22 @@ function changeTransactionsReport( ); } - // 5. Optimistically update the transaction thread and all threads in the transaction thread - optimisticData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT}${newIOUAction.childReportID}`, - value: { - parentReportID: targetReportID, - parentReportActionID: optimisticMoneyRequestReportActionID, - policyID: reportID !== CONST.REPORT.UNREPORTED_REPORT_ID && newReport ? newReport.policyID : CONST.POLICY.ID_FAKE, - ...(isUnreported ? {participants: {[currentUserAccountID]: {notificationPreference: ''}}} : {}), - }, - }); + const shouldRemoveOtherParticipants = !isManagedCardTransaction(transaction); + const childReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${newIOUAction.childReportID}`]; + if (childReport) { + const participants = childReport.participants; + // 5. Optimistically update the transaction thread and all threads in the transaction thread + optimisticData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${newIOUAction.childReportID}`, + value: { + parentReportID: targetReportID, + parentReportActionID: optimisticMoneyRequestReportActionID, + policyID: reportID !== CONST.REPORT.UNREPORTED_REPORT_ID && newReport ? newReport.policyID : CONST.POLICY.ID_FAKE, + participants: isUnreported && shouldRemoveOtherParticipants ? {[currentUserAccountID]: participants?.[currentUserAccountID]} : participants, + }, + }); + } if (oldIOUAction) { failureData.push({