diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 24471b7f0140..dd82a5863206 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -297,7 +297,7 @@ Onyx.connect({ const transactionThreadReportID = ReportActionUtils.getOneTransactionThreadReportID(reportID, actions[reportActions[0]]); if (transactionThreadReportID) { const transactionThreadReportActionsArray = Object.values(actions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`] ?? {}); - sortedReportActions = ReportActionUtils.getCombinedReportActions(reportActionsArray, transactionThreadReportID, transactionThreadReportActionsArray, reportID); + sortedReportActions = ReportActionUtils.getCombinedReportActions(sortedReportActions, transactionThreadReportID, transactionThreadReportActionsArray, reportID); } lastReportActions[reportID] = sortedReportActions[0]; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 2132b97ef555..df5b27635670 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -383,11 +383,14 @@ function getCombinedReportActions( transactionThreadReportActions: ReportAction[], reportID?: string, ): ReportAction[] { - if (_.isEmpty(transactionThreadReportID)) { + const isSentMoneyReport = reportActions.some((action) => isSentMoneyReportAction(action)); + + // We don't want to combine report actions of transaction thread in iou report of send money request because we display the transaction report of send money request as a normal thread + if (_.isEmpty(transactionThreadReportID) || isSentMoneyReport) { return reportActions; } - // Filter out the created action from the transaction thread report actions, since we already have the parent report's created action in `reportActions` + // Filter out request money actions because we don't want to show any preview actions for one transaction reports const filteredTransactionThreadReportActions = transactionThreadReportActions?.filter((action) => action.actionName !== CONST.REPORT.ACTIONS.TYPE.CREATED); const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const isSelfDM = report?.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM; @@ -398,9 +401,9 @@ function getCombinedReportActions( } const actionType = getOriginalMessage(action)?.type ?? ''; if (isSelfDM) { - return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && !isSentMoneyReportAction(action); + return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE; } - return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && actionType !== CONST.IOU.REPORT_ACTION_TYPE.TRACK && !isSentMoneyReportAction(action); + return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && actionType !== CONST.IOU.REPORT_ACTION_TYPE.TRACK; }); return getSortedReportActions(filteredReportActions, true); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index cca52ac37c9d..3fec32a849ed 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2918,7 +2918,7 @@ function getTransactionReportName(reportAction: OnyxEntry