Skip to content

Commit

Permalink
Merge pull request #13887 from Expensify/marco-ignoreCloseAction
Browse files Browse the repository at this point in the history
Ignore close action for archived workspace chats
  • Loading branch information
mountiny authored Jan 14, 2023
2 parents f3600bf + ba1acb4 commit 7ca2979
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/libs/ReportActionsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 26 additions & 2 deletions tests/unit/ReportActionsUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}],
},
{
Expand All @@ -138,7 +162,7 @@ describe('ReportActionsUtils', () => {
message: [{html: 'Hello world'}],
},
{
actionName: 'REIMBURSED',
actionName: CONST.REPORT.ACTIONS.TYPE.CLOSED,
message: [{html: 'Hello world'}],
},
];
Expand Down

0 comments on commit 7ca2979

Please sign in to comment.