Skip to content

Commit

Permalink
Merge pull request Expensify#48226 from Expensify/beaman-showGBRForKi…
Browse files Browse the repository at this point in the history
…ckedApprover

Show GBR if manager w/out parent access on procesing report
  • Loading branch information
marcochavezf authored Aug 30, 2024
2 parents d71e95b + 4395c98 commit 489312e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2524,17 +2524,24 @@ function getLastVisibleMessage(reportID: string | undefined, actionsToMerge: Rep
}

/**
* Checks if a report is an open task report assigned to current user.
* Checks if a report is waiting for the manager to complete an action.
* Example: the assignee of an open task report or the manager of a processing expense report.
*
* @param [parentReportAction] - The parent report action of the report (Used to check if the task has been canceled)
*/
function isWaitingForAssigneeToCompleteTask(report: OnyxEntry<Report>, parentReportAction: OnyxEntry<ReportAction>): boolean {
function isWaitingForAssigneeToCompleteAction(report: OnyxEntry<Report>, parentReportAction: OnyxEntry<ReportAction>): boolean {
if (report?.hasOutstandingChildTask) {
return true;
}

if (isOpenTaskReport(report, parentReportAction) && !report?.hasParentAccess && isReportManager(report)) {
return true;
if (!report?.hasParentAccess && isReportManager(report)) {
if (isOpenTaskReport(report, parentReportAction)) {
return true;
}

if (isProcessingReport(report) && isExpenseReport(report)) {
return true;
}
}

return false;
Expand Down Expand Up @@ -2580,7 +2587,7 @@ function requiresAttentionFromCurrentUser(optionOrReport: OnyxEntry<Report> | Op
return true;
}

if (isWaitingForAssigneeToCompleteTask(optionOrReport, parentReportAction)) {
if (isWaitingForAssigneeToCompleteAction(optionOrReport, parentReportAction)) {
return true;
}

Expand Down Expand Up @@ -7969,7 +7976,7 @@ export {
isUserCreatedPolicyRoom,
isValidReport,
isValidReportIDFromPath,
isWaitingForAssigneeToCompleteTask,
isWaitingForAssigneeToCompleteAction,
isInvoiceRoom,
isInvoiceRoomWithID,
isInvoiceReport,
Expand Down

0 comments on commit 489312e

Please sign in to comment.