Skip to content

Commit 0755455

Browse files
committed
fix: Unexpected error when approver hold expense
1 parent 47fee90 commit 0755455

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/libs/ReportSecondaryActionUtils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
hasOnlyNonReimbursableTransactions,
5959
hasReportBeenReopened as hasReportBeenReopenedUtils,
6060
hasReportBeenRetracted as hasReportBeenRetractedUtils,
61+
isActionCreator,
6162
isArchivedReport,
6263
isAwaitingFirstLevelApproval,
6364
isClosedReport as isClosedReportUtils,
@@ -68,6 +69,7 @@ import {
6869
isInvoiceReport as isInvoiceReportUtils,
6970
isIOUReport as isIOUReportUtils,
7071
isMoneyRequestReportEligibleForMerge,
72+
isOpenExpenseReport,
7173
isOpenReport as isOpenReportUtils,
7274
isPayer as isPayerUtils,
7375
isProcessingReport as isProcessingReportUtils,
@@ -562,6 +564,11 @@ function isHoldActionForTransaction(
562564
const iouOrExpenseReport = isExpenseReport || isIOUReport;
563565
const holdReportAction = getReportAction(reportAction?.childReportID, `${reportTransaction?.comment?.hold ?? ''}`);
564566
const {canHoldRequest} = canHoldUnholdReportAction(report, reportAction, holdReportAction, reportTransaction, policy, currentUserAccountID);
567+
const isActionOwner = isActionCreator(reportAction);
568+
569+
if (isOpenExpenseReport(report)) {
570+
return isActionOwner;
571+
}
565572

566573
if (!iouOrExpenseReport || !canHoldRequest) {
567574
return false;

src/libs/actions/IOU/Hold.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ function putOnHold(
161161
| typeof ONYXKEYS.COLLECTION.REPORT
162162
| typeof ONYXKEYS.COLLECTION.REPORT_METADATA
163163
| typeof ONYXKEYS.COLLECTION.NEXT_STEP
164+
| typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS
164165
>
165166
> = [
166167
{
@@ -189,6 +190,11 @@ function putOnHold(
189190
lastVisibleActionCreated: transactionThreadReport.lastVisibleActionCreated,
190191
},
191192
},
193+
{
194+
onyxMethod: Onyx.METHOD.MERGE,
195+
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
196+
value: transactionViolations,
197+
},
192198
];
193199

194200
// If the transaction thread report wasn't created before, we create it optimistically

0 commit comments

Comments
 (0)