@@ -74,20 +74,20 @@ function MoneyRequestPreviewContent({
74
74
const route = useRoute < PlatformStackRouteProp < TransactionDuplicateNavigatorParamList , typeof SCREENS . TRANSACTION_DUPLICATE . REVIEW > > ( ) ;
75
75
const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
76
76
const [ personalDetails ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST ) ;
77
- const [ chatReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReportID || '-1' } ` ) ;
77
+ const [ chatReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReportID || CONST . DEFAULT_NUMBER_ID } ` ) ;
78
78
const [ session ] = useOnyx ( ONYXKEYS . SESSION ) ;
79
- const [ iouReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReportID || '-1' } ` ) ;
79
+ const [ iouReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReportID || CONST . DEFAULT_NUMBER_ID } ` ) ;
80
80
81
81
const policy = PolicyUtils . getPolicy ( iouReport ?. policyID ) ;
82
82
const isMoneyRequestAction = ReportActionsUtils . isMoneyRequestAction ( action ) ;
83
- const transactionID = isMoneyRequestAction ? ReportActionsUtils . getOriginalMessage ( action ) ?. IOUTransactionID : '-1' ;
83
+ const transactionID = isMoneyRequestAction ? ReportActionsUtils . getOriginalMessage ( action ) ?. IOUTransactionID : undefined ;
84
84
const [ transaction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` ) ;
85
85
const [ walletTerms ] = useOnyx ( ONYXKEYS . WALLET_TERMS ) ;
86
86
const [ transactionViolations ] = useOnyx ( ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS ) ;
87
87
88
88
const sessionAccountID = session ?. accountID ;
89
- const managerID = iouReport ?. managerID ?? - 1 ;
90
- const ownerAccountID = iouReport ?. ownerAccountID ?? - 1 ;
89
+ const managerID = iouReport ?. managerID ?? CONST . DEFAULT_NUMBER_ID ;
90
+ const ownerAccountID = iouReport ?. ownerAccountID ?? CONST . DEFAULT_NUMBER_ID ;
91
91
const isPolicyExpenseChat = ReportUtils . isPolicyExpenseChat ( chatReport ) ;
92
92
93
93
const participantAccountIDs =
@@ -117,9 +117,9 @@ function MoneyRequestPreviewContent({
117
117
const isOnHold = TransactionUtils . isOnHold ( transaction ) ;
118
118
const isSettlementOrApprovalPartial = ! ! iouReport ?. pendingFields ?. partial ;
119
119
const isPartialHold = isSettlementOrApprovalPartial && isOnHold ;
120
- const hasViolations = TransactionUtils . hasViolation ( transaction ?. transactionID ?? '-1' , transactionViolations , true ) ;
121
- const hasNoticeTypeViolations = TransactionUtils . hasNoticeTypeViolation ( transaction ?. transactionID ?? '-1' , transactionViolations , true ) && ReportUtils . isPaidGroupPolicy ( iouReport ) ;
122
- const hasWarningTypeViolations = TransactionUtils . hasWarningTypeViolation ( transaction ?. transactionID ?? '-1' , transactionViolations , true ) ;
120
+ const hasViolations = TransactionUtils . hasViolation ( transaction ?. transactionID , transactionViolations , true ) ;
121
+ const hasNoticeTypeViolations = TransactionUtils . hasNoticeTypeViolation ( transaction ?. transactionID , transactionViolations , true ) && ReportUtils . isPaidGroupPolicy ( iouReport ) ;
122
+ const hasWarningTypeViolations = TransactionUtils . hasWarningTypeViolation ( transaction ?. transactionID , transactionViolations , true ) ;
123
123
const hasFieldErrors = TransactionUtils . hasMissingSmartscanFields ( transaction ) ;
124
124
const isDistanceRequest = TransactionUtils . isDistanceRequest ( transaction ) ;
125
125
const isFetchingWaypointsFromServer = TransactionUtils . isFetchingWaypointsFromServer ( transaction ) ;
@@ -155,8 +155,8 @@ function MoneyRequestPreviewContent({
155
155
const shouldShowHoldMessage = ! ( isSettled && ! isSettlementOrApprovalPartial ) && ! ! transaction ?. comment ?. hold ;
156
156
157
157
const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ route . params ?. threadReportID } ` ) ;
158
- const parentReportAction = ReportActionsUtils . getReportAction ( report ?. parentReportID ?? '' , report ?. parentReportActionID ?? '' ) ;
159
- const reviewingTransactionID = ReportActionsUtils . isMoneyRequestAction ( parentReportAction ) ? ReportActionsUtils . getOriginalMessage ( parentReportAction ) ?. IOUTransactionID ?? '-1' : '-1' ;
158
+ const parentReportAction = ReportActionsUtils . getReportAction ( report ?. parentReportID , report ?. parentReportActionID ) ;
159
+ const reviewingTransactionID = ReportActionsUtils . isMoneyRequestAction ( parentReportAction ) ? ReportActionsUtils . getOriginalMessage ( parentReportAction ) ?. IOUTransactionID : undefined ;
160
160
161
161
/*
162
162
Show the merchant for IOUs and expenses only if:
@@ -253,10 +253,10 @@ function MoneyRequestPreviewContent({
253
253
if ( TransactionUtils . isPending ( transaction ) ) {
254
254
return { shouldShow : true , messageIcon : Expensicons . CreditCardHourglass , messageDescription : translate ( 'iou.transactionPending' ) } ;
255
255
}
256
- if ( TransactionUtils . shouldShowBrokenConnectionViolation ( transaction ?. transactionID ?? '-1' , iouReport , policy ) ) {
256
+ if ( TransactionUtils . shouldShowBrokenConnectionViolation ( transaction ?. transactionID , iouReport , policy ) ) {
257
257
return { shouldShow : true , messageIcon : Expensicons . Hourglass , messageDescription : translate ( 'violations.brokenConnection530Error' ) } ;
258
258
}
259
- if ( TransactionUtils . hasPendingUI ( transaction , TransactionUtils . getTransactionViolations ( transaction ?. transactionID ?? '-1' , transactionViolations ) ) ) {
259
+ if ( TransactionUtils . hasPendingUI ( transaction , TransactionUtils . getTransactionViolations ( transaction ?. transactionID , transactionViolations ) ) ) {
260
260
return { shouldShow : true , messageIcon : Expensicons . Hourglass , messageDescription : translate ( 'iou.pendingMatchWithCreditCard' ) } ;
261
261
}
262
262
return { shouldShow : false } ;
@@ -301,12 +301,8 @@ function MoneyRequestPreviewContent({
301
301
// Clear the draft before selecting a different expense to prevent merging fields from the previous expense
302
302
// (e.g., category, tag, tax) that may be not enabled/available in the new expense's policy.
303
303
Transaction . abandonReviewDuplicateTransactions ( ) ;
304
- const comparisonResult = TransactionUtils . compareDuplicateTransactionFields (
305
- reviewingTransactionID ,
306
- transaction ?. reportID ?? '' ,
307
- transaction ?. transactionID ?? reviewingTransactionID ,
308
- ) ;
309
- Transaction . setReviewDuplicatesKey ( { ...comparisonResult . keep , duplicates, transactionID : transaction ?. transactionID ?? '' , reportID : transaction ?. reportID } ) ;
304
+ const comparisonResult = TransactionUtils . compareDuplicateTransactionFields ( reviewingTransactionID , transaction ?. reportID , transaction ?. transactionID ?? reviewingTransactionID ) ;
305
+ Transaction . setReviewDuplicatesKey ( { ...comparisonResult . keep , duplicates, transactionID : transaction ?. transactionID , reportID : transaction ?. reportID } ) ;
310
306
311
307
if ( 'merchant' in comparisonResult . change ) {
312
308
Navigation . navigate ( ROUTES . TRANSACTION_DUPLICATE_REVIEW_MERCHANT_PAGE . getRoute ( route . params ?. threadReportID , backTo ) ) ;
@@ -349,11 +345,13 @@ function MoneyRequestPreviewContent({
349
345
! onPreviewPressed ? [ styles . moneyRequestPreviewBox , containerStyles ] : { } ,
350
346
] }
351
347
>
352
- < ReportActionItemImages
353
- images = { receiptImages }
354
- isHovered = { isHovered || isScanning }
355
- size = { 1 }
356
- />
348
+ { ! isDeleted && (
349
+ < ReportActionItemImages
350
+ images = { receiptImages }
351
+ isHovered = { isHovered || isScanning }
352
+ size = { 1 }
353
+ />
354
+ ) }
357
355
{ isEmptyObject ( transaction ) && ! ReportActionsUtils . isMessageDeleted ( action ) && action . pendingAction !== CONST . RED_BRICK_ROAD_PENDING_ACTION . DELETE ? (
358
356
< MoneyRequestSkeletonView />
359
357
) : (
0 commit comments