Skip to content

Commit e6b0777

Browse files
committed
delete option for empty invoice report
1 parent 30d781e commit e6b0777

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/libs/ReportSecondaryActionUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,16 @@ function isDeleteAction(report: Report, reportTransactions: Transaction[], repor
418418
const isOwner = transactionID ? getIOUActionForTransactionID(reportActions, transactionID)?.actorAccountID === getCurrentUserAccountID() : false;
419419
const isReportOpenOrProcessing = isOpenReportUtils(report) || isProcessingReportUtils(report);
420420
const isSingleTransaction = reportTransactions.length === 1;
421+
const isInvoiceReport = isInvoiceReportUtils(report);
421422

422423
if (isUnreported) {
423424
return isOwner;
424425
}
425426

427+
if (isInvoiceReport) {
428+
return report?.ownerAccountID === getCurrentUserAccountID();
429+
}
430+
426431
// Users cannot delete a report in the unreported or IOU cases, but they can delete individual transactions.
427432
// So we check if the reportTransactions length is 1 which means they're viewing a single transaction and thus can delete it.
428433
if (isIOUReport) {

0 commit comments

Comments
 (0)