Skip to content

Commit

Permalink
Merge pull request #48362 from Expensify/beaman-showExpenseReportInLH…
Browse files Browse the repository at this point in the history
…NIfManagerNoParentAccess

Show report in LHN if user is expense report manager without access to parent policyChat
  • Loading branch information
marcochavezf authored Sep 2, 2024
2 parents 2cb8354 + 410d6f6 commit f0c1725
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7729,6 +7729,10 @@ function getApprovalChain(policy: OnyxEntry<Policy>, employeeAccountID: number,
return approvalChain;
}

function isSubmittedExpenseReportManagerWithoutParentAccess(report: OnyxEntry<Report>) {
return isExpenseReport(report) && report?.hasParentAccess === false && report?.managerID === currentUserAccountID && isProcessingReport(report);
}

export {
addDomainToShortMention,
completeShortMention,
Expand Down Expand Up @@ -7924,6 +7928,7 @@ export {
isEmptyReport,
isRootGroupChat,
isExpenseReport,
isSubmittedExpenseReportManagerWithoutParentAccess,
isExpenseRequest,
isExpensifyOnlyParticipantInReport,
isGroupChat,
Expand Down
5 changes: 4 additions & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ function getOrderedReportIDs(
return;
}
const isSystemChat = ReportUtils.isSystemChat(report);
const shouldOverrideHidden = hasValidDraftComment(report.reportID) || hasErrorsOtherThanFailedReceipt || isFocused || isSystemChat || report.isPinned;
const isSubmittedExpenseReportManagerWithoutParentAccess = ReportUtils.isSubmittedExpenseReportManagerWithoutParentAccess(report);
const shouldOverrideHidden =
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
hasValidDraftComment(report.reportID) || hasErrorsOtherThanFailedReceipt || isFocused || isSystemChat || report.isPinned || isSubmittedExpenseReportManagerWithoutParentAccess;
if (isHidden && !shouldOverrideHidden) {
return;
}
Expand Down

0 comments on commit f0c1725

Please sign in to comment.