diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 0a18b10b126f..c79c4573281d 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5387,8 +5387,6 @@ function shouldReportBeInOptionList({ report?.reportName === undefined || // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing report?.isHidden || - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - participantAccountIDs.includes(CONST.ACCOUNT_ID.NOTIFICATIONS) || (participantAccountIDs.length === 0 && !isChatThread(report) && !isPublicRoom(report) && @@ -5404,6 +5402,10 @@ function shouldReportBeInOptionList({ return false; } + if (participantAccountIDs.includes(CONST.ACCOUNT_ID.NOTIFICATIONS) && (!currentUserAccountID || !AccountUtils.isAccountIDOddNumber(currentUserAccountID))) { + return false; + } + if (!canAccessReport(report, policies, betas)) { return false; } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 7929c2d60475..e44643f391c1 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -11,7 +11,6 @@ import type PriorityMode from '@src/types/onyx/PriorityMode'; import type Report from '@src/types/onyx/Report'; import type ReportAction from '@src/types/onyx/ReportAction'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; -import AccountUtils from './AccountUtils'; import * as CollectionUtils from './CollectionUtils'; import {hasValidDraftComment} from './DraftCommentUtils'; import localeCompare from './LocaleCompare'; @@ -43,14 +42,6 @@ Onyx.connect({ }, }); -let currentUserAccountID: number | undefined; -Onyx.connect({ - key: ONYXKEYS.SESSION, - callback: (value) => { - currentUserAccountID = value?.accountID; - }, -}); - function compareStringDates(a: string, b: string): 0 | 1 | -1 { if (a < b) { return -1; @@ -115,13 +106,6 @@ function getOrderedReportIDs( return false; } - const participantAccountIDs = Object.keys(report?.participants ?? {}).map(Number); - const isOnboardedByPersona = currentUserAccountID && AccountUtils.isAccountIDOddNumber(currentUserAccountID) && participantAccountIDs.includes(CONST.ACCOUNT_ID.NOTIFICATIONS); - - if (isOnboardedByPersona && isSystemChat && !isInFocusMode) { - return true; - } - return ReportUtils.shouldReportBeInOptionList({ report, currentReportId: currentReportId ?? '-1',