From 18825f65d5bd70e6499df4a8e677877587f0c2af Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 28 May 2025 15:16:54 -0700 Subject: [PATCH 1/3] remove CCO restriction for conversational corrections in one transaction views --- src/libs/actions/Report.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 2de7dda4a5b0..842442f25c71 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -824,25 +824,20 @@ function addComment(reportID: string, text: string, shouldPlaySound?: boolean) { if (shouldPlaySound) { playSound(SOUNDS.DONE); } - // If we are resolving a Concierge Category Options action on an expense report that only has a single transaction thread child report, we need to add the action to the transaction thread instead. + // If we are adding an action on an expense report that only has a single transaction thread child report, we need to add the action to the transaction thread instead. // This is because we need it to be associated with the transaction thread and not the expense report. if (isExpenseReport(allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`])) { const reportActions = allReportActions?.[reportID]; if (reportActions) { - const moneyRequestPreviewActions = Object.values(reportActions).filter((action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); + const moneyRequestPreviewActions = Object.values(reportActions).filter( + (action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && !ReportActionsUtils.isDeletedAction(action), + ); if (moneyRequestPreviewActions.length === 1) { const transactionThreadReportID = moneyRequestPreviewActions.at(0)?.childReportID; if (transactionThreadReportID) { - const transactionThreadReportActions = allReportActions?.[transactionThreadReportID]; - if (transactionThreadReportActions) { - const conciergeCategoryOptionsAction = Object.values(transactionThreadReportActions).find( - (action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.CONCIERGE_CATEGORY_OPTIONS, - ); - if (conciergeCategoryOptionsAction && !ReportActionsUtils.isResolvedConciergeCategoryOptions(conciergeCategoryOptionsAction)) { - addActions(transactionThreadReportID, text); - return; - } - } + console.log('>>>> Adding action to transaction thread', transactionThreadReportID); + addActions(transactionThreadReportID, text); + return; } } } From 705212c866dad7683c252bf03e6ff784a622c40a Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 28 May 2025 15:27:58 -0700 Subject: [PATCH 2/3] remove debug log --- src/libs/actions/Report.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 842442f25c71..88deddbfddea 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -825,7 +825,7 @@ function addComment(reportID: string, text: string, shouldPlaySound?: boolean) { playSound(SOUNDS.DONE); } // If we are adding an action on an expense report that only has a single transaction thread child report, we need to add the action to the transaction thread instead. - // This is because we need it to be associated with the transaction thread and not the expense report. + // This is because we need it to be associated with the transaction thread and not the expense report in order for conversational corrections to work as expected. if (isExpenseReport(allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`])) { const reportActions = allReportActions?.[reportID]; if (reportActions) { @@ -835,7 +835,6 @@ function addComment(reportID: string, text: string, shouldPlaySound?: boolean) { if (moneyRequestPreviewActions.length === 1) { const transactionThreadReportID = moneyRequestPreviewActions.at(0)?.childReportID; if (transactionThreadReportID) { - console.log('>>>> Adding action to transaction thread', transactionThreadReportID); addActions(transactionThreadReportID, text); return; } From cd5bde7e391d5554b80b1e7d7ae89747c26a0cf5 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Fri, 30 May 2025 11:59:47 -0700 Subject: [PATCH 3/3] extend to IOUs --- src/libs/actions/Report.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 0e6176c8167a..1d139d485dd4 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -828,7 +828,7 @@ function addComment(reportID: string, text: string, shouldPlaySound?: boolean) { } // If we are adding an action on an expense report that only has a single transaction thread child report, we need to add the action to the transaction thread instead. // This is because we need it to be associated with the transaction thread and not the expense report in order for conversational corrections to work as expected. - if (isExpenseReport(allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`])) { + if (isMoneyRequestReport(allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`])) { const reportActions = allReportActions?.[reportID]; if (reportActions) { const moneyRequestPreviewActions = Object.values(reportActions).filter(