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

(cherry picked from commit 69aaec3)

(CP triggered by luacmartins)
  • Loading branch information
francoisl authored and OSBotify committed Dec 12, 2024
1 parent 9fbac49 commit 6d553ea
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 @@ -295,11 +295,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 6d553ea

Please sign in to comment.