@@ -2257,13 +2257,15 @@ function getReportPreviewMessage(
2257
2257
} ) ;
2258
2258
}
2259
2259
2260
+ let linkedTransaction ;
2260
2261
if ( ! isEmptyObject ( reportAction ) && shouldConsiderReceiptBeingScanned && reportAction && ReportActionsUtils . isMoneyRequestAction ( reportAction ) ) {
2261
- const linkedTransaction = TransactionUtils . getLinkedTransaction ( reportAction ) ;
2262
+ linkedTransaction = TransactionUtils . getLinkedTransaction ( reportAction ) ;
2263
+ }
2262
2264
2263
- if ( ! isEmptyObject ( linkedTransaction ) && TransactionUtils . hasReceipt ( linkedTransaction ) && TransactionUtils . isReceiptBeingScanned ( linkedTransaction ) ) {
2264
- return Localize . translateLocal ( 'iou.receiptScanning' ) ;
2265
- }
2265
+ if ( ! isEmptyObject ( linkedTransaction ) && TransactionUtils . hasReceipt ( linkedTransaction ) && TransactionUtils . isReceiptBeingScanned ( linkedTransaction ) ) {
2266
+ return Localize . translateLocal ( 'iou.receiptScanning' ) ;
2266
2267
}
2268
+
2267
2269
const originalMessage = reportAction ?. originalMessage as IOUMessage | undefined ;
2268
2270
2269
2271
// Show Paid preview message if it's settled or if the amount is paid & stuck at receivers end for only chat reports.
@@ -2290,21 +2292,26 @@ function getReportPreviewMessage(
2290
2292
return Localize . translateLocal ( 'iou.waitingOnBankAccount' , { submitterDisplayName} ) ;
2291
2293
}
2292
2294
2293
- const containsNonReimbursable = hasNonReimbursableTransactions ( report . reportID ) ;
2294
-
2295
2295
const lastActorID = reportAction ?. actorAccountID ;
2296
+ let amount = originalMessage ?. amount ;
2297
+ let currency = originalMessage ?. currency ? originalMessage ?. currency : report . currency ;
2298
+
2299
+ if ( ! isEmptyObject ( linkedTransaction ) ) {
2300
+ amount = TransactionUtils . getAmount ( linkedTransaction , isExpenseReport ( report ) ) ;
2301
+ currency = TransactionUtils . getCurrency ( linkedTransaction ) ;
2302
+ }
2296
2303
2297
2304
// if we have the amount in the originalMessage and lastActorID, we can use that to display the preview message for the latest request
2298
- if ( originalMessage ?. amount !== undefined && lastActorID && ! isPreviewMessageForParentChatReport ) {
2299
- const amount = originalMessage ?. amount ;
2300
- const currency = originalMessage ?. currency ?? report . currency ?? '' ;
2305
+ if ( amount !== undefined && lastActorID && ! isPreviewMessageForParentChatReport ) {
2301
2306
const amountToDisplay = CurrencyUtils . convertToDisplayString ( Math . abs ( amount ) , currency ) ;
2302
2307
2303
2308
// We only want to show the actor name in the preview if it's not the current user who took the action
2304
2309
const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant ( lastActorID , ! isPreviewMessageForParentChatReport ) : '' ;
2305
2310
return `${ requestorName ? `${ requestorName } : ` : '' } ${ Localize . translateLocal ( 'iou.requestedAmount' , { formattedAmount : amountToDisplay } ) } ` ;
2306
2311
}
2307
2312
2313
+ const containsNonReimbursable = hasNonReimbursableTransactions ( report . reportID ) ;
2314
+
2308
2315
return Localize . translateLocal ( containsNonReimbursable ? 'iou.payerSpentAmount' : 'iou.payerOwesAmount' , { payer : payerName ?? '' , amount : formattedAmount } ) ;
2309
2316
}
2310
2317
@@ -4582,6 +4589,7 @@ function canEditReportDescription(report: OnyxEntry<Report>, policy: OnyxEntry<P
4582
4589
( getVisibleMemberIDs ( report ) . includes ( currentUserAccountID ?? 0 ) || getParticipantsIDs ( report ) . includes ( currentUserAccountID ?? 0 ) )
4583
4590
) ;
4584
4591
}
4592
+
4585
4593
/**
4586
4594
* Checks if report action has error when smart scanning
4587
4595
*/
0 commit comments