From d8025e065804ee3ac32aa303b90b0f69a16b8842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Thu, 29 Dec 2022 12:56:51 -0600 Subject: [PATCH 1/3] ignore close action --- src/pages/home/report/ReportActionItem.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 7158f15f37bb..f456070a97b6 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -170,6 +170,10 @@ class ReportActionItem extends Component { } render() { + // Ignore closed action here since we're already displaying a footer that explains why the report was closed + if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED) { + return null; + } if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) { return ; } From bc68ea0ece55ba36a03c623eecf6f7663a7f1f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Fri, 30 Dec 2022 16:23:38 -0600 Subject: [PATCH 2/3] filter out closed action in report action utils --- src/libs/ReportActionsUtils.js | 5 +++++ src/pages/home/report/ReportActionItem.js | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index 9c3bfcec0318..365909507d79 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -79,6 +79,11 @@ function filterReportActionsForDisplay(reportActions) { return false; } + // Ignore closed action here since we're already displaying a footer that explains why the report was closed + if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED) { + return false; + } + // All other actions are displayed except deleted, non-pending actions const isDeleted = isDeletedAction(reportAction); const isPending = !_.isEmpty(reportAction.pendingAction); diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index f456070a97b6..7158f15f37bb 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -170,10 +170,6 @@ class ReportActionItem extends Component { } render() { - // Ignore closed action here since we're already displaying a footer that explains why the report was closed - if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED) { - return null; - } if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) { return ; } From ba1acb4c7b37f3f9aa0ef92a54342ce565c40e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Fri, 6 Jan 2023 17:26:11 -0600 Subject: [PATCH 3/3] update existing unit test and add new one for closed action --- tests/unit/ReportActionsUtilsTest.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/unit/ReportActionsUtilsTest.js b/tests/unit/ReportActionsUtilsTest.js index ccda75b52587..91fb4dd56000 100644 --- a/tests/unit/ReportActionsUtilsTest.js +++ b/tests/unit/ReportActionsUtilsTest.js @@ -74,7 +74,31 @@ describe('ReportActionsUtils', () => { message: [{html: 'Hello world'}], }, { - actionName: CONST.REPORT.ACTIONS.TYPE.CLOSED, + actionName: CONST.REPORT.ACTIONS.TYPE.CREATED, + message: [{html: 'Hello world'}], + }, + { + actionName: CONST.REPORT.ACTIONS.TYPE.IOU, + message: [{html: 'Hello world'}], + }, + { + actionName: CONST.REPORT.ACTIONS.TYPE.RENAMED, + message: [{html: 'Hello world'}], + }, + { + actionName: 'REIMBURSED', + message: [{html: 'Hello world'}], + }, + ]; + const result = ReportActionsUtils.filterReportActionsForDisplay(input); + input.pop(); + expect(result).toStrictEqual(input); + }); + + it('should filter out closed actions', () => { + const input = [ + { + actionName: CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT, message: [{html: 'Hello world'}], }, { @@ -90,7 +114,7 @@ describe('ReportActionsUtils', () => { message: [{html: 'Hello world'}], }, { - actionName: 'REIMBURSED', + actionName: CONST.REPORT.ACTIONS.TYPE.CLOSED, message: [{html: 'Hello world'}], }, ];