Skip to content
Merged
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
19 changes: 0 additions & 19 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,6 @@ Onyx.connect({
callback: (value) => (allReports = value),
});

let doesDomainHaveApprovedAccountant = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should remove doesDomainHaveApprovedAccountant from the BE now? 🤔 cc @yuwenmemon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if we're not using it in the front-end anymore I can certainly rip it out of the back end!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It originally came from: https://github.com/Expensify/Expensify/issues/257570

I presume we're just showing domain rooms universally now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we're hiding them from approved accountants: https://expensify.slack.com/archives/C03SSAQ7P/p1713199776085039

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, same same for this though! I created an issue here so I don't forget: https://github.com/Expensify/Expensify/issues/389013

Copy link
Contributor

@flodnv flodnv Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

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 @@ -1072,14 +1066,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 @@ -4450,11 +4436,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