@@ -112,6 +112,7 @@ import {
112112 buildOptimisticReportPreview ,
113113 buildOptimisticRoomDescriptionUpdatedReportAction ,
114114 buildOptimisticSelfDMReport ,
115+ buildOptimisticUnHoldReportAction ,
115116 buildOptimisticUnreportedTransactionAction ,
116117 canUserPerformWriteAction as canUserPerformWriteActionReportUtils ,
117118 findLastAccessedReport ,
@@ -158,6 +159,7 @@ import {
158159} from '@libs/ReportUtils' ;
159160import shouldSkipDeepLinkNavigation from '@libs/shouldSkipDeepLinkNavigation' ;
160161import playSound , { SOUNDS } from '@libs/Sound' ;
162+ import { isOnHold } from '@libs/TransactionUtils' ;
161163import { addTrailingForwardSlash } from '@libs/Url' ;
162164import Visibility from '@libs/Visibility' ;
163165import type { FileObject } from '@pages/media/AttachmentModalScreen/types' ;
@@ -4815,7 +4817,7 @@ function deleteAppReport(reportID: string | undefined) {
48154817 {
48164818 onyxMethod : Onyx . METHOD . MERGE ,
48174819 key : `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` ,
4818- value : { reportID : CONST . REPORT . UNREPORTED_REPORT_ID } ,
4820+ value : { reportID : CONST . REPORT . UNREPORTED_REPORT_ID , comment : { hold : null } } ,
48194821 } ,
48204822 {
48214823 onyxMethod : Onyx . METHOD . MERGE ,
@@ -4828,14 +4830,40 @@ function deleteAppReport(reportID: string | undefined) {
48284830 {
48294831 onyxMethod : Onyx . METHOD . MERGE ,
48304832 key : `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` ,
4831- value : { reportID : transaction ?. reportID } ,
4833+ value : { reportID : transaction ?. reportID , comment : { hold : transaction ?. comment ?. hold } } ,
48324834 } ,
48334835 {
48344836 onyxMethod : Onyx . METHOD . MERGE ,
48354837 key : `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } ${ transactionID } ` ,
48364838 value : transactionViolations ,
48374839 } ,
48384840 ) ;
4841+
4842+ if ( isOnHold ( transaction ) ) {
4843+ const unHoldAction = buildOptimisticUnHoldReportAction ( ) ;
4844+ optimisticData . push ( {
4845+ onyxMethod : Onyx . METHOD . MERGE ,
4846+ key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ childReportID } ` ,
4847+ value : { [ unHoldAction . reportActionID ] : unHoldAction } ,
4848+ } ) ;
4849+
4850+ successData . push ( {
4851+ onyxMethod : Onyx . METHOD . MERGE ,
4852+ key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ childReportID } ` ,
4853+ value : { [ unHoldAction . reportActionID ] : { pendingAction : null } } ,
4854+ } ) ;
4855+
4856+ failureData . push ( {
4857+ onyxMethod : Onyx . METHOD . MERGE ,
4858+ key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ childReportID } ` ,
4859+ value : { [ unHoldAction . reportActionID ] : null } ,
4860+ } ) ;
4861+
4862+ transactionIDToReportActionAndThreadData [ transactionID ] = {
4863+ ...transactionIDToReportActionAndThreadData [ transactionID ] ,
4864+ unholdReportActionID : unHoldAction . reportActionID ,
4865+ } ;
4866+ }
48394867 }
48404868
48414869 // 2. Move the report action to self DM
@@ -4919,6 +4947,7 @@ function deleteAppReport(reportID: string | undefined) {
49194947
49204948 if ( transactionID ) {
49214949 transactionIDToReportActionAndThreadData [ transactionID ] = {
4950+ ...transactionIDToReportActionAndThreadData [ transactionID ] ,
49224951 moneyRequestPreviewReportActionID : newReportActionID ,
49234952 movedReportActionID : unreportedAction ?. reportActionID ,
49244953 } ;
0 commit comments