Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,25 +826,19 @@ 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.
// 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}`])) {
// 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 (isMoneyRequestReport(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;
}
}
addActions(transactionThreadReportID, text);
return;
}
}
}
Expand Down