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: Unpinned and read 'Expensify' chat persists in LHN in '#focus' #44061

Merged
merged 3 commits into from
Jun 24, 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
6 changes: 4 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand All @@ -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;
}
Expand Down
16 changes: 0 additions & 16 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down
Loading