From aa419ad661509f48d9756a593399c00bf01c022e Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 22 Sep 2025 11:49:34 -0600 Subject: [PATCH] Revert "Fix GBR shown for approver with report that only contains held expenses" --- src/libs/ReportUtils.ts | 5 ++++- tests/unit/ReportUtilsTest.ts | 32 -------------------------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index cad7d1244ef0..f7c048b97429 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3743,7 +3743,10 @@ function getReasonAndReportActionThatRequiresAttention( // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(optionOrReport.policyID); - if (optionOrReport.hasOutstandingChildRequest === true && (policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO || !hasOnlyPendingTransactions)) { + if ( + (optionOrReport.hasOutstandingChildRequest === true || iouReportActionToApproveOrPay?.reportActionID) && + (policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO || !hasOnlyPendingTransactions) + ) { return { reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION, reportAction: iouReportActionToApproveOrPay, diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 0def65b26a89..8ceb73d77fa5 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -5346,38 +5346,6 @@ describe('ReportUtils', () => { // Then the result is null expect(result).toBe(null); }); - - it('should return a reason for report with hasOutstandingChildRequest', async () => { - // Given an expense report with hasOutstandingChildRequest - const report: OptionData = { - ...createRandomReport(30000), - type: CONST.REPORT.TYPE.EXPENSE, - hasOutstandingChildRequest: true, - }; - await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); - - // When the reason is retrieved - const result = getReasonAndReportActionThatRequiresAttention(report, undefined, false); - - // Then the reason should be CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION - expect(result?.reason).toBe(CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION); - }); - - it('should return null for report with no hasOutstandingChildRequest', async () => { - // Given an expense report with no hasOutstandingChildRequest - const report: OptionData = { - ...createRandomReport(30000), - type: CONST.REPORT.TYPE.EXPENSE, - hasOutstandingChildRequest: false, - }; - await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); - - // When the reason is retrieved - const result = getReasonAndReportActionThatRequiresAttention(report, undefined, false); - - // Then the result is null - expect(result).toBe(null); - }); }); describe('canEditReportDescription', () => {