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

Fix: Hide paycheck report with error #45698

Merged
merged 9 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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 @@ -842,6 +842,8 @@ const CONST = {
IOU: 'iou',
TASK: 'task',
INVOICE: 'invoice',
},
UNSUPPORTED: {
cretadn22 marked this conversation as resolved.
Show resolved Hide resolved
PAYCHECK: 'paycheck',
BILL: 'bill',
},
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5468,7 +5468,7 @@ function shouldReportBeInOptionList({
return false;
}

if (report?.type === CONST.REPORT.TYPE.PAYCHECK || report?.type === CONST.REPORT.TYPE.BILL) {
if ((Object.values(CONST.REPORT.UNSUPPORTED) as string[]).includes(report?.type ?? '')) {
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ function getOrderedReportIDs(
if (!report) {
return;
}
if ((Object.values(CONST.REPORT.UNSUPPORTED) as string[]).includes(report?.type ?? '')) {
return;
}
const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`] ?? {};
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1');
const doesReportHaveViolations = OptionsListUtils.shouldShowViolations(report, betas ?? [], transactionViolations);
Expand Down
11 changes: 9 additions & 2 deletions tests/unit/SidebarFilterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,18 @@ xdescribe('Sidebar', () => {
it('filter paycheck and bill report', () => {
const report1: Report = {
...LHNTestUtils.getFakeReport(),
type: CONST.REPORT.TYPE.PAYCHECK,
type: CONST.REPORT.UNSUPPORTED.PAYCHECK,
};
const report2: Report = {
...LHNTestUtils.getFakeReport(),
type: CONST.REPORT.TYPE.BILL,
type: CONST.REPORT.UNSUPPORTED.BILL,
errorFields: {
notFound: {
1721083106781482: 'Report not found',
1721140343800206: 'Report not found',
1721149017870362: 'Report not found',
},
},
};
const report3: Report = LHNTestUtils.getFakeReport();
LHNTestUtils.getDefaultRenderedSidebarLinks(report1.reportID);
Expand Down
Loading