From 6948e588fb49f4ca4b95ce8d42d92be6a56935ce Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 3 Apr 2024 15:03:15 +0100 Subject: [PATCH 1/3] Filter out the send money actions too --- src/pages/home/report/ReportActionsView.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index e7bf0c1337cd..6ca529750265 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -145,9 +145,13 @@ function ReportActionsView({ // Filter out the created action from the transaction thread report actions, since we already have the parent report's created action in `reportActions` const filteredTransactionThreadReportActions = transactionThreadReportActions?.filter((action) => action.actionName !== CONST.REPORT.ACTIONS.TYPE.CREATED); - // Filter out "created" IOU report actions because we don't want to show any preview actions for one transaction reports + // Filter out request and send money request actions because we don't want to show any preview actions for one transaction reports const filteredReportActions = [...allReportActions, ...filteredTransactionThreadReportActions].filter( - (action) => ((action as OnyxTypes.OriginalMessageIOU).originalMessage?.type ?? '') !== CONST.IOU.REPORT_ACTION_TYPE.CREATE, + (action) => { + const actionType = (action as OnyxTypes.OriginalMessageIOU).originalMessage?.type ?? ''; + const isSendMoneyAction = Boolean(actionType === CONST.IOU.REPORT_ACTION_TYPE.PAY && (action as OnyxTypes.OriginalMessageIOU).originalMessage?.IOUDetails); + return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && !isSendMoneyAction; + } ); return ReportActionsUtils.getSortedReportActions(filteredReportActions, true); }, [allReportActions, transactionThreadReportActions]); From 9947d054b3ce14673a2734c6416b924a821bb5a5 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 3 Apr 2024 15:04:20 +0100 Subject: [PATCH 2/3] Prettier --- src/pages/home/report/ReportActionsView.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 6ca529750265..40097d1e1c51 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -146,13 +146,11 @@ function ReportActionsView({ const filteredTransactionThreadReportActions = transactionThreadReportActions?.filter((action) => action.actionName !== CONST.REPORT.ACTIONS.TYPE.CREATED); // Filter out request and send money request actions because we don't want to show any preview actions for one transaction reports - const filteredReportActions = [...allReportActions, ...filteredTransactionThreadReportActions].filter( - (action) => { - const actionType = (action as OnyxTypes.OriginalMessageIOU).originalMessage?.type ?? ''; - const isSendMoneyAction = Boolean(actionType === CONST.IOU.REPORT_ACTION_TYPE.PAY && (action as OnyxTypes.OriginalMessageIOU).originalMessage?.IOUDetails); - return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && !isSendMoneyAction; - } - ); + const filteredReportActions = [...allReportActions, ...filteredTransactionThreadReportActions].filter((action) => { + const actionType = (action as OnyxTypes.OriginalMessageIOU).originalMessage?.type ?? ''; + const isSendMoneyAction = Boolean(actionType === CONST.IOU.REPORT_ACTION_TYPE.PAY && (action as OnyxTypes.OriginalMessageIOU).originalMessage?.IOUDetails); + return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && !isSendMoneyAction; + }); return ReportActionsUtils.getSortedReportActions(filteredReportActions, true); }, [allReportActions, transactionThreadReportActions]); From 9f2081ab645bf6f5521cf78365e51f6b1f205462 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 3 Apr 2024 18:19:33 +0100 Subject: [PATCH 3/3] Use utility method --- src/pages/home/report/ReportActionsView.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 40097d1e1c51..ef436e57dc10 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -148,8 +148,7 @@ function ReportActionsView({ // Filter out request and send money request actions because we don't want to show any preview actions for one transaction reports const filteredReportActions = [...allReportActions, ...filteredTransactionThreadReportActions].filter((action) => { const actionType = (action as OnyxTypes.OriginalMessageIOU).originalMessage?.type ?? ''; - const isSendMoneyAction = Boolean(actionType === CONST.IOU.REPORT_ACTION_TYPE.PAY && (action as OnyxTypes.OriginalMessageIOU).originalMessage?.IOUDetails); - return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && !isSendMoneyAction; + return actionType !== CONST.IOU.REPORT_ACTION_TYPE.CREATE && !ReportActionsUtils.isSentMoneyReportAction(action); }); return ReportActionsUtils.getSortedReportActions(filteredReportActions, true); }, [allReportActions, transactionThreadReportActions]);