Skip to content

Commit

Permalink
Reduce isPolicyOwnedByExpensifyAccounts to one line
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetlath committed Oct 31, 2023
1 parent f35acb9 commit 70a10f7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3669,9 +3669,7 @@ function getMoneyRequestOptions(report, reportParticipants) {

// We don't allow IOU actions if an Expensify account is a participant of the report, unless the policy that the report is on is owned by an Expensify account
const doParticipantsIncludeExpensifyAccounts = lodashIntersection(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS).length > 0;
const policyID = lodashGet(report, 'policyID', '');
const policyOwnerAccountID = lodashGet(allPolicies, [`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, 'ownerAccountID'], 0);
const isPolicyOwnedByExpensifyAccounts = CONST.EXPENSIFY_ACCOUNT_IDS.includes(policyOwnerAccountID);
const isPolicyOwnedByExpensifyAccounts = report.policyID ? CONST.EXPENSIFY_ACCOUNT_IDS.includes(getPolicy(report.policyID).ownerAccountID || 0) : false;
if (doParticipantsIncludeExpensifyAccounts && !isPolicyOwnedByExpensifyAccounts) {
return [];
}
Expand Down

0 comments on commit 70a10f7

Please sign in to comment.