Skip to content

Commit

Permalink
Merge pull request #53955 from cretadn22/check-pending-transaction
Browse files Browse the repository at this point in the history
Hide approve button if transactions are pending
  • Loading branch information
mountiny authored Dec 18, 2024
2 parents a5913b9 + 0c720d5 commit 53c0bd7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,11 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string): SearchTr
) {
return CONST.SEARCH.ACTION_TYPES.PAY;
}
const hasOnlyPendingTransactions =
allReportTransactions.length > 0 && allReportTransactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t));

const isAllowedToApproveExpenseReport = ReportUtils.isAllowedToApproveExpenseReport(report, undefined, policy);
if (IOU.canApproveIOU(report, policy) && isAllowedToApproveExpenseReport) {
if (IOU.canApproveIOU(report, policy) && isAllowedToApproveExpenseReport && !hasOnlyPendingTransactions) {
return CONST.SEARCH.ACTION_TYPES.APPROVE;
}

Expand Down

0 comments on commit 53c0bd7

Please sign in to comment.