Skip to content

Commit

Permalink
Merge pull request #54056 from Expensify/cmartins-fixSearchSubmit
Browse files Browse the repository at this point in the history
[CP Staging] Fix submit action
  • Loading branch information
francoisl authored Dec 12, 2024
2 parents a4b4933 + 349eda0 commit 69aaec3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,13 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string): SearchTr
return CONST.SEARCH.ACTION_TYPES.PAY;
}

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

if (IOU.canSubmitReport(report, policy)) {
// We check for isAllowedToApproveExpenseReport because if the policy has preventSelfApprovals enabled, we disable the Submit action and in that case we want to show the View action instead
if (IOU.canSubmitReport(report, policy) && isAllowedToApproveExpenseReport) {
return CONST.SEARCH.ACTION_TYPES.SUBMIT;
}

Expand Down

0 comments on commit 69aaec3

Please sign in to comment.