Skip to content

Commit

Permalink
fix: Unpinned and read 'Expensify' chat persists in LHN in '#focus'
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictb committed Jun 20, 2024
1 parent af9be0a commit 68db63f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2633,4 +2633,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 66a5c97ae1059e4da1993a4ad95abe5d819f555b

COCOAPODS: 1.13.0
COCOAPODS: 1.14.3
7 changes: 5 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) &&
Expand All @@ -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;
}
Expand Down
15 changes: 0 additions & 15 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 68db63f

Please sign in to comment.