Skip to content

Commit

Permalink
Merge pull request #44061 from dominictb/fix/43599
Browse files Browse the repository at this point in the history
fix: Unpinned and read 'Expensify' chat persists in LHN in '#focus'
  • Loading branch information
tgolen authored Jun 24, 2024
2 parents 936b051 + 6fc46c5 commit d19a574
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
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

0 comments on commit d19a574

Please sign in to comment.