diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index 38c3994b24b5..cc438b605c35 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -83,6 +83,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/tests/unit/ReportActionsUtilsTest.js b/tests/unit/ReportActionsUtilsTest.js index 24fdcff9f354..8431555a8985 100644 --- a/tests/unit/ReportActionsUtilsTest.js +++ b/tests/unit/ReportActionsUtilsTest.js @@ -122,7 +122,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'}], }, { @@ -138,7 +162,7 @@ describe('ReportActionsUtils', () => { message: [{html: 'Hello world'}], }, { - actionName: 'REIMBURSED', + actionName: CONST.REPORT.ACTIONS.TYPE.CLOSED, message: [{html: 'Hello world'}], }, ];