Skip to content

Commit

Permalink
Refactor function names and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Jan 18, 2024
1 parent 94b6a69 commit af744fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function isDraftExpenseReport(report: OnyxEntry<Report> | EmptyObject): boolean
/**
* Checks if the supplied report has a common policy member with the array passed in params.
*/
function hasReportCommonPolicyMemberWithArray(report: Report, policyMemberAccountIDs: number[]) {
function hasParticipantInArray(report: Report, policyMemberAccountIDs: number[]) {
if (!report.participantAccountIDs) {
return false;
}
Expand Down Expand Up @@ -837,12 +837,12 @@ function isConciergeChatReport(report: OnyxEntry<Report>): boolean {
}

/**
* Checks if the supplied report belongs to workspace based on the provided params.
* Checks if the supplied report belongs to workspace based on the provided params. If the report's policyID is _FAKE_ or has no value, it means this report is a DM.
* In this case report and workspace members must be compared to deteremine whether the report belongs to the workspace.
*/
function doesReportBelongToWorkspace(report: Report, policyID: string, policyMemberAccountIDs: number[]) {
return (
isConciergeChatReport(report) ||
(report.policyID === CONST.POLICY.ID_FAKE || !report.policyID ? hasReportCommonPolicyMemberWithArray(report, policyMemberAccountIDs) : report.policyID === policyID)
isConciergeChatReport(report) || (report.policyID === CONST.POLICY.ID_FAKE || !report.policyID ? hasParticipantInArray(report, policyMemberAccountIDs) : report.policyID === policyID)
);
}

Expand Down

0 comments on commit af744fd

Please sign in to comment.