From 68db63f48cb61cf3af5d701c931e960ee5df92d4 Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 20 Jun 2024 10:22:09 +0700 Subject: [PATCH 1/2] fix: Unpinned and read 'Expensify' chat persists in LHN in '#focus' --- ios/Podfile.lock | 2 +- src/libs/ReportUtils.ts | 7 +++++-- src/libs/SidebarUtils.ts | 15 --------------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1e1626e5d73..121605a0d53 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2633,4 +2633,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 66a5c97ae1059e4da1993a4ad95abe5d819f555b -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1e772d7b18f..ccf2280c974 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -58,6 +58,7 @@ import type {Comment, Receipt, TransactionChanges, WaypointCollection} from '@sr import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; +import AccountUtils from './AccountUtils'; import * as IOU from './actions/IOU'; import * as PolicyActions from './actions/Policy/Policy'; import * as store from './actions/ReimbursementAccount/store'; @@ -5334,8 +5335,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) && @@ -5351,6 +5350,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 4e5185c56cc..071ceebaa67 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -12,7 +12,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'; @@ -44,14 +43,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; @@ -116,12 +107,6 @@ function getOrderedReportIDs( return false; } - const participantAccountIDs = Object.keys(report?.participants ?? {}).map(Number); - - if (currentUserAccountID && AccountUtils.isAccountIDOddNumber(currentUserAccountID) && participantAccountIDs.includes(CONST.ACCOUNT_ID.NOTIFICATIONS)) { - return true; - } - return ReportUtils.shouldReportBeInOptionList({ report, currentReportId: currentReportId ?? '-1', From aca4770e20719ecb61730e9797e17383913eefe6 Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 20 Jun 2024 10:31:43 +0700 Subject: [PATCH 2/2] revert podfile --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 121605a0d53..1e1626e5d73 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2633,4 +2633,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 66a5c97ae1059e4da1993a4ad95abe5d819f555b -COCOAPODS: 1.14.3 +COCOAPODS: 1.13.0