diff --git a/src/libs/ReportSecondaryActionUtils.ts b/src/libs/ReportSecondaryActionUtils.ts index 26aabad2a1f..b26d0f6b0e3 100644 --- a/src/libs/ReportSecondaryActionUtils.ts +++ b/src/libs/ReportSecondaryActionUtils.ts @@ -58,6 +58,7 @@ import { hasOnlyNonReimbursableTransactions, hasReportBeenReopened as hasReportBeenReopenedUtils, hasReportBeenRetracted as hasReportBeenRetractedUtils, + isActionCreator, isArchivedReport, isAwaitingFirstLevelApproval, isClosedReport as isClosedReportUtils, @@ -68,6 +69,7 @@ import { isInvoiceReport as isInvoiceReportUtils, isIOUReport as isIOUReportUtils, isMoneyRequestReportEligibleForMerge, + isOpenExpenseReport, isOpenReport as isOpenReportUtils, isPayer as isPayerUtils, isProcessingReport as isProcessingReportUtils, @@ -562,6 +564,11 @@ function isHoldActionForTransaction( const iouOrExpenseReport = isExpenseReport || isIOUReport; const holdReportAction = getReportAction(reportAction?.childReportID, `${reportTransaction?.comment?.hold ?? ''}`); const {canHoldRequest} = canHoldUnholdReportAction(report, reportAction, holdReportAction, reportTransaction, policy, currentUserAccountID); + const isActionOwner = isActionCreator(reportAction); + + if (isOpenExpenseReport(report)) { + return isActionOwner; + } if (!iouOrExpenseReport || !canHoldRequest) { return false; diff --git a/src/libs/actions/IOU/Hold.ts b/src/libs/actions/IOU/Hold.ts index 61c3ac69c46..8e8a807ed2f 100644 --- a/src/libs/actions/IOU/Hold.ts +++ b/src/libs/actions/IOU/Hold.ts @@ -161,6 +161,7 @@ function putOnHold( | typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_METADATA | typeof ONYXKEYS.COLLECTION.NEXT_STEP + | typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS > > = [ { @@ -189,6 +190,11 @@ function putOnHold( lastVisibleActionCreated: transactionThreadReport.lastVisibleActionCreated, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, + value: transactionViolations, + }, ]; // If the transaction thread report wasn't created before, we create it optimistically