Skip to content

Commit

Permalink
Merge pull request #40298 from ShridharGoel/patch-4
Browse files Browse the repository at this point in the history
Exclude domain rooms check from canSeeDefaultRooms
  • Loading branch information
flodnv authored Apr 18, 2024
2 parents ab7f7ae + 49b77e4 commit 99b736e
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,6 @@ Onyx.connect({
callback: (value) => (allReports = value),
});

let doesDomainHaveApprovedAccountant = false;
Onyx.connect({
key: ONYXKEYS.ACCOUNT,
callback: (value) => (doesDomainHaveApprovedAccountant = value?.doesDomainHaveApprovedAccountant ?? false),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY,
Expand Down Expand Up @@ -1073,14 +1067,6 @@ function canCreateTaskInReport(report: OnyxEntry<Report>): boolean {
return true;
}

/**
* Returns true if there are any Expensify accounts (i.e. with domain 'expensify.com') in the set of accountIDs
* by cross-referencing the accountIDs with personalDetails.
*/
function hasExpensifyEmails(accountIDs: number[]): boolean {
return accountIDs.some((accountID) => Str.extractEmailDomain(allPersonalDetails?.[accountID]?.login ?? '') === CONST.EXPENSIFY_PARTNER_NAME);
}

/**
* Returns true if there are any guides accounts (team.expensify.com) in a list of accountIDs
* by cross-referencing the accountIDs with personalDetails since guides that are participants
Expand Down Expand Up @@ -4549,11 +4535,6 @@ function canSeeDefaultRoom(report: OnyxEntry<Report>, policies: OnyxCollection<P
return true;
}

// Include domain rooms with Partner Managers (Expensify accounts) in them for accounts that are on a domain with an Approved Accountant
if (isDomainRoom(report) && doesDomainHaveApprovedAccountant && hasExpensifyEmails(report?.participantAccountIDs ?? [])) {
return true;
}

// If the room has an assigned guide, it can be seen.
if (hasExpensifyGuidesEmails(report?.participantAccountIDs ?? [])) {
return true;
Expand Down

0 comments on commit 99b736e

Please sign in to comment.