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
13 changes: 12 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11046,6 +11046,12 @@ function isAdminOwnerApproverOrReportOwner(report: OnyxEntry<Report>, policy: On
return isPolicyAdminPolicyUtils(policy) || isPolicyOwner(policy, currentUserAccountID) || isReportOwner(report) || isApprover;
}

function isNonOwnerMangerOfIOUReport(report: OnyxEntry<Report>): boolean {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NAB I don't think we need a function for this since it's only used once.

const isOwner = report?.ownerAccountID === currentUserPersonalDetails?.accountID;
const isManager = report?.managerID === currentUserPersonalDetails?.accountID;
return isIOUReport(report) && !isOwner && !isManager;
}

/**
* Whether the user can join a report
*/
Expand Down Expand Up @@ -11124,7 +11130,12 @@ function canLeaveChat(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, isRe
return canLeaveInvoiceRoom(report);
}

return (isChatThread(report) && !!getReportNotificationPreference(report)) || isUserCreatedPolicyRoom(report) || isNonAdminOrOwnerOfPolicyExpenseChat(report, policy);
return (
(isChatThread(report) && !!getReportNotificationPreference(report)) ||
isUserCreatedPolicyRoom(report) ||
isNonAdminOrOwnerOfPolicyExpenseChat(report, policy) ||
isNonOwnerMangerOfIOUReport(report)
);
}

function createDraftWorkspaceAndNavigateToConfirmationScreen(introSelected: OnyxEntry<IntroSelected>, transactionID: string, actionName: IOUAction): void {
Expand Down
Loading