Skip to content

Commit 6d553ea

Browse files
francoislOSBotify
authored andcommitted
Merge pull request #54056 from Expensify/cmartins-fixSearchSubmit
[CP Staging] Fix submit action (cherry picked from commit 69aaec3) (CP triggered by luacmartins)
1 parent 9fbac49 commit 6d553ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libs/SearchUIUtils.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,13 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string): SearchTr
295295
return CONST.SEARCH.ACTION_TYPES.PAY;
296296
}
297297

298-
if (IOU.canApproveIOU(report, policy) && ReportUtils.isAllowedToApproveExpenseReport(report, undefined, policy)) {
298+
const isAllowedToApproveExpenseReport = ReportUtils.isAllowedToApproveExpenseReport(report, undefined, policy);
299+
if (IOU.canApproveIOU(report, policy) && isAllowedToApproveExpenseReport) {
299300
return CONST.SEARCH.ACTION_TYPES.APPROVE;
300301
}
301302

302-
if (IOU.canSubmitReport(report, policy)) {
303+
// 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
304+
if (IOU.canSubmitReport(report, policy) && isAllowedToApproveExpenseReport) {
303305
return CONST.SEARCH.ACTION_TYPES.SUBMIT;
304306
}
305307

0 commit comments

Comments
 (0)