From ea7c7574ca8a1c6d996a51d48ee4694adf9ebbc8 Mon Sep 17 00:00:00 2001 From: ijaazA Date: Mon, 17 Nov 2025 16:21:03 +0530 Subject: [PATCH 1/3] Fix/75109: When auto-reporting is disabled, user cannot submit expense to 1:1 DM from FAB --- .../iou/request/step/IOURequestStepConfirmation.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 89a7c823bfafc..94c57d2ed8084 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -520,6 +520,8 @@ function IOURequestStepConfirmation({ if (!participant) { return; } + const shouldUseParentChatReport = participant.isPolicyExpenseChat; + const parentChatReport = shouldUseParentChatReport ? report : undefined; const optimisticChatReportID = generateReportID(); const optimisticCreatedReportActionID = rand64(); @@ -539,7 +541,7 @@ function IOURequestStepConfirmation({ } const {iouReport} = requestMoneyIOUActions({ - report, + report: parentChatReport, existingIOUReport, optimisticChatReportID, optimisticCreatedReportActionID, @@ -675,12 +677,14 @@ function IOURequestStepConfirmation({ if (!participant) { return; } + const shouldUseParentChatReport = participant.isPolicyExpenseChat; + const parentChatReport = shouldUseParentChatReport ? report : undefined; transactions.forEach((item, index) => { const isLinkedTrackedExpenseReportArchived = !!item.linkedTrackedExpenseReportID && archivedReportsIdSet.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${item.linkedTrackedExpenseReportID}`); trackExpenseIOUActions({ - report, + report: parentChatReport, isDraftPolicy, action, participantParams: { @@ -749,8 +753,11 @@ function IOURequestStepConfirmation({ if (!transaction) { return; } + const participant = selectedParticipants.at(0); + const shouldUseParentChatReport = participant?.isPolicyExpenseChat ?? false; + const parentChatReport = shouldUseParentChatReport ? report : undefined; createDistanceRequestIOUActions({ - report, + report: parentChatReport, participants: selectedParticipants, currentUserLogin: currentUserPersonalDetails.login, currentUserAccountID: currentUserPersonalDetails.accountID, From 9ed9154bec2d896d09c81a7719335ac8b75eced7 Mon Sep 17 00:00:00 2001 From: ijaazA Date: Tue, 18 Nov 2025 13:06:05 +0530 Subject: [PATCH 2/3] fixed comments --- .../step/IOURequestStepConfirmation.tsx | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 94c57d2ed8084..fa27c6d456ee0 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -510,6 +510,21 @@ function IOURequestStepConfirmation({ }); }, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]); + function getMoneyRequestContextForParticipant(participant: Participant | undefined, report: Report | undefined) { + const isWorkspaceTarget = !!participant?.isPolicyExpenseChat; + return { + parentChatReport: isWorkspaceTarget ? report : undefined, + policyParams: isWorkspaceTarget + ? { + policy, + policyTagList: policyTags, + policyCategories, + policyRecentlyUsedCategories, + } + : {}, + }; + } + const requestMoney = useCallback( (selectedParticipants: Participant[], gpsPoint?: GpsPoint) => { if (!transactions.length) { @@ -520,8 +535,8 @@ function IOURequestStepConfirmation({ if (!participant) { return; } - const shouldUseParentChatReport = participant.isPolicyExpenseChat; - const parentChatReport = shouldUseParentChatReport ? report : undefined; + + const {parentChatReport, policyParams} = getMoneyRequestContextForParticipant(participant, report); const optimisticChatReportID = generateReportID(); const optimisticCreatedReportActionID = rand64(); @@ -551,12 +566,7 @@ function IOURequestStepConfirmation({ payeeAccountID: currentUserPersonalDetails.accountID, participant, }, - policyParams: { - policy, - policyTagList: policyTags, - policyCategories, - policyRecentlyUsedCategories, - }, + policyParams, gpsPoint, action, transactionParams: { @@ -677,8 +687,9 @@ function IOURequestStepConfirmation({ if (!participant) { return; } - const shouldUseParentChatReport = participant.isPolicyExpenseChat; - const parentChatReport = shouldUseParentChatReport ? report : undefined; + + const {parentChatReport, policyParams} = getMoneyRequestContextForParticipant(participant, report); + transactions.forEach((item, index) => { const isLinkedTrackedExpenseReportArchived = !!item.linkedTrackedExpenseReportID && archivedReportsIdSet.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${item.linkedTrackedExpenseReportID}`); @@ -692,11 +703,7 @@ function IOURequestStepConfirmation({ payeeAccountID: currentUserPersonalDetails.accountID, participant, }, - policyParams: { - policy, - policyCategories, - policyTagList: policyTags, - }, + policyParams, transactionParams: { amount: item.amount, distance: isManualDistanceRequest ? (item.comment?.customUnit?.quantity ?? undefined) : undefined, @@ -753,9 +760,14 @@ function IOURequestStepConfirmation({ if (!transaction) { return; } + const participant = selectedParticipants.at(0); - const shouldUseParentChatReport = participant?.isPolicyExpenseChat ?? false; - const parentChatReport = shouldUseParentChatReport ? report : undefined; + if (!participant) { + return; + } + + const {parentChatReport, policyParams} = getMoneyRequestContextForParticipant(participant, report); + createDistanceRequestIOUActions({ report: parentChatReport, participants: selectedParticipants, @@ -763,12 +775,7 @@ function IOURequestStepConfirmation({ currentUserAccountID: currentUserPersonalDetails.accountID, iouType, existingTransaction: transaction, - policyParams: { - policy, - policyCategories, - policyTagList: policyTags, - policyRecentlyUsedCategories, - }, + policyParams, transactionParams: { amount: transaction.amount, comment: trimmedComment, From fbea6e24626a985e9acccabd0b9a5b6298ccc2f1 Mon Sep 17 00:00:00 2001 From: ijaazA Date: Tue, 18 Nov 2025 17:30:10 +0530 Subject: [PATCH 3/3] updated lint fixes --- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 172f2cfd50496..5d4a7ee869e89 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -512,10 +512,10 @@ function IOURequestStepConfirmation({ }); }, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]); - function getMoneyRequestContextForParticipant(participant: Participant | undefined, report: Report | undefined) { + function getMoneyRequestContextForParticipant(participant: Participant | undefined, reportParam: Report | undefined) { const isWorkspaceTarget = !!participant?.isPolicyExpenseChat; return { - parentChatReport: isWorkspaceTarget ? report : undefined, + parentChatReport: isWorkspaceTarget ? reportParam : undefined, policyParams: isWorkspaceTarget ? { policy,