Skip to content

Commit 0a8bce9

Browse files
authored
Merge pull request Expensify#73530 from Expensify/revert-72984-fix_72212
Revert "fix: Delete option is missing in More menu of an unpaid invoice report"
2 parents 03888da + fb0d4ac commit 0a8bce9

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

‎src/libs/ReportUtils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@ function canDeleteMoneyRequestReport(report: Report, reportTransactions: Transac
27432743
}
27442744

27452745
if (isInvoiceReport(report)) {
2746-
return report?.ownerAccountID === currentUserAccountID && isReportOpenOrProcessing;
2746+
return report?.ownerAccountID === currentUserAccountID && isReportOpenOrProcessing && policy?.approvalMode !== CONST.POLICY.APPROVAL_MODE.OPTIONAL;
27472747
}
27482748

27492749
// Users cannot delete a report in the unreported or IOU cases, but they can delete individual transactions.

‎tests/unit/ReportUtilsTest.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
buildTransactionThread,
2727
canAddTransaction,
2828
canCreateRequest,
29-
canDeleteMoneyRequestReport,
3029
canDeleteReportAction,
3130
canDeleteTransaction,
3231
canEditMoneyRequest,
@@ -3053,13 +3052,6 @@ describe('ReportUtils', () => {
30533052
});
30543053
});
30553054

3056-
describe('canDeleteMoneyRequestReport', () => {
3057-
it('should allow deletion if the report is open invoice report', () => {
3058-
const invoiceReport = {...createInvoiceReport(343), ownerAccountID: currentUserAccountID, stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: CONST.REPORT.STATUS_NUM.OPEN};
3059-
expect(canDeleteMoneyRequestReport(invoiceReport, [], [])).toBe(true);
3060-
});
3061-
});
3062-
30633055
describe('shouldDisableThread', () => {
30643056
const reportID = '1';
30653057

0 commit comments

Comments
 (0)