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 scan expense report and transaction are not hidden #39389

Merged
merged 14 commits into from
Apr 12, 2024
7 changes: 5 additions & 2 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type Report from '@src/types/onyx/Report';
import type {ReportActions} from '@src/types/onyx/ReportAction';
import type ReportAction from '@src/types/onyx/ReportAction';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import * as CollectionUtils from './CollectionUtils';
import localeCompare from './LocaleCompare';
import * as LocalePhoneNumber from './LocalePhoneNumber';
Expand Down Expand Up @@ -89,9 +90,11 @@ function getOrderedReportIDs(
betas.includes(CONST.BETAS.VIOLATIONS) && !!parentReportAction && ReportUtils.doesTransactionThreadHaveViolations(report, transactionViolations, parentReportAction);
const isHidden = report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
const isFocused = report.reportID === currentReportId;
const hasErrors = Object.keys(OptionsListUtils.getAllReportErrors(report, reportActions) ?? {}).length !== 0;
const allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions) ?? {};
const hasErrors = Object.keys(allReportErrors).length !== 0;
const hasBrickError = hasErrors || doesReportHaveViolations ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
const shouldOverrideHidden = hasBrickError || isFocused || report.isPinned;
const hasNonFailedReceiptError = isEmptyObject(allReportErrors) || Object.values(allReportErrors).some((error) => error?.[0] !== 'report.genericSmartscanFailureMessage');
tienifr marked this conversation as resolved.
Show resolved Hide resolved
const shouldOverrideHidden = (hasBrickError && hasNonFailedReceiptError) || isFocused || report.isPinned;
if (isHidden && !shouldOverrideHidden) {
return false;
}
Expand Down
Loading