@@ -530,7 +530,14 @@ function isMarkAsExportedAction(currentAccountID: number, currentUserLogin: stri
530530 return ( isAdmin && syncEnabled ) || ( isExporter && ! syncEnabled ) ;
531531}
532532
533- function isHoldAction ( report : Report , chatReport : OnyxEntry < Report > , reportTransactions : Transaction [ ] , reportActions : ReportAction [ ] | undefined , policy : OnyxEntry < Policy > ) : boolean {
533+ function isHoldAction (
534+ report : Report ,
535+ chatReport : OnyxEntry < Report > ,
536+ reportTransactions : Transaction [ ] ,
537+ reportActions : ReportAction [ ] | undefined ,
538+ policy : OnyxEntry < Policy > ,
539+ currentUserAccountID : number | undefined ,
540+ ) : boolean {
534541 const transactionThreadReportID = getOneTransactionThreadReportID ( report , chatReport , reportActions ) ;
535542 const isOneExpenseReport = reportTransactions . length === 1 ;
536543 const transaction = reportTransactions . at ( 0 ) ;
@@ -540,15 +547,21 @@ function isHoldAction(report: Report, chatReport: OnyxEntry<Report>, reportTrans
540547 }
541548
542549 const action = ! ! reportActions && getIOUActionForTransactionID ( reportActions , transaction . transactionID ) ;
543- return ! ! action && isHoldActionForTransaction ( report , transaction , action , policy ) ;
550+ return ! ! action && isHoldActionForTransaction ( report , transaction , action , policy , currentUserAccountID ) ;
544551}
545552
546- function isHoldActionForTransaction ( report : Report , reportTransaction : Transaction , reportAction : ReportAction , policy : OnyxEntry < Policy > ) : boolean {
553+ function isHoldActionForTransaction (
554+ report : Report ,
555+ reportTransaction : Transaction ,
556+ reportAction : ReportAction ,
557+ policy : OnyxEntry < Policy > ,
558+ currentUserAccountID : number | undefined ,
559+ ) : boolean {
547560 const isExpenseReport = isExpenseReportUtils ( report ) ;
548561 const isIOUReport = isIOUReportUtils ( report ) ;
549562 const iouOrExpenseReport = isExpenseReport || isIOUReport ;
550563 const holdReportAction = getReportAction ( reportAction ?. childReportID , `${ reportTransaction ?. comment ?. hold ?? '' } ` ) ;
551- const { canHoldRequest} = canHoldUnholdReportAction ( report , reportAction , holdReportAction , reportTransaction , policy ) ;
564+ const { canHoldRequest} = canHoldUnholdReportAction ( report , reportAction , holdReportAction , reportTransaction , policy , currentUserAccountID ) ;
552565
553566 if ( ! iouOrExpenseReport || ! canHoldRequest ) {
554567 return false ;
@@ -954,7 +967,7 @@ function getSecondaryReportActions({
954967 options . push ( CONST . REPORT . SECONDARY_ACTIONS . REOPEN ) ;
955968 }
956969
957- if ( isHoldAction ( report , chatReport , reportTransactions , reportActions , policy ) ) {
970+ if ( isHoldAction ( report , chatReport , reportTransactions , reportActions , policy , currentUserAccountID ) ) {
958971 options . push ( CONST . REPORT . SECONDARY_ACTIONS . HOLD ) ;
959972 }
960973
@@ -1066,7 +1079,7 @@ function getSecondaryTransactionThreadActions(
10661079) : Array < ValueOf < typeof CONST . REPORT . TRANSACTION_SECONDARY_ACTIONS > > {
10671080 const options : Array < ValueOf < typeof CONST . REPORT . TRANSACTION_SECONDARY_ACTIONS > > = [ ] ;
10681081
1069- if ( ! ! reportAction && isHoldActionForTransaction ( parentReport , reportTransaction , reportAction , policy ) ) {
1082+ if ( ! ! reportAction && isHoldActionForTransaction ( parentReport , reportTransaction , reportAction , policy , currentUserAccountID ) ) {
10701083 options . push ( CONST . REPORT . TRANSACTION_SECONDARY_ACTIONS . HOLD ) ;
10711084 }
10721085
0 commit comments