Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out paycheck report on LHN #45186

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,8 @@ const CONST = {
IOU: 'iou',
TASK: 'task',
INVOICE: 'invoice',
PAYCHECK: 'paycheck',
BILL: 'bill',
},
CHAT_TYPE: chatTypes,
WORKSPACE_CHAT_ROOMS: {
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5459,6 +5459,10 @@ function shouldReportBeInOptionList({
return false;
}

if (report?.type === CONST.REPORT.TYPE.PAYCHECK || report?.type === CONST.REPORT.TYPE.BILL) {
return false;
}

// Include the currently viewed report. If we excluded the currently viewed report, then there
// would be no way to highlight it in the options list and it would be confusing to users because they lose
// a sense of context.
Expand Down
29 changes: 29 additions & 0 deletions tests/unit/SidebarFilterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,35 @@ xdescribe('Sidebar', () => {
);
});

it('filter paycheck and bill report', () => {
const report1: Report = {
...LHNTestUtils.getFakeReport(),
type: CONST.REPORT.TYPE.PAYCHECK,
};
const report2: Report = {
...LHNTestUtils.getFakeReport(),
type: CONST.REPORT.TYPE.BILL,
};
const report3: Report = LHNTestUtils.getFakeReport();
LHNTestUtils.getDefaultRenderedSidebarLinks(report1.reportID);
const reportCollectionDataSet: ReportCollectionDataSet = {
[`${ONYXKEYS.COLLECTION.REPORT}${report1.reportID}`]: report1,
[`${ONYXKEYS.COLLECTION.REPORT}${report2.reportID}`]: report2,
[`${ONYXKEYS.COLLECTION.REPORT}${report3.reportID}`]: report3,
};
return (
waitForBatchedUpdates()
.then(() => Onyx.multiSet(reportCollectionDataSet))

// Then the reports 1 and 2 are hidden and 3 is not
.then(() => {
const hintText = Localize.translateLocal('accessibilityHints.navigatesToChat');
const optionRows = screen.queryAllByAccessibilityHint(hintText);
expect(optionRows).toHaveLength(1);
})
);
});

// NOTE: This is also for #focus mode, should we move this test block?
describe('all combinations of isArchived, isUserCreatedPolicyRoom, hasAddWorkspaceError, isUnread, isPinned, hasDraft', () => {
// Given a report that is the active report and doesn't change
Expand Down
Loading