From 21b22158674d532f51460870ef416735d7c798fb Mon Sep 17 00:00:00 2001 From: c3024 Date: Wed, 18 Oct 2023 21:07:48 +0530 Subject: [PATCH 1/2] get image from iou if no source in transaction --- src/components/MoneyRequestConfirmationList.js | 3 ++- src/libs/ReceiptUtils.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 5c71ab7a5c78..5ca08bf82f89 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -536,7 +536,8 @@ function MoneyRequestConfirmationList(props) { ); }, [confirm, props.bankAccountRoute, props.iouCurrencyCode, props.iouType, props.isReadOnly, props.policyID, selectedParticipants, splitOrRequestOptions, translate, formError]); - const {image: receiptImage, thumbnail: receiptThumbnail} = props.receiptPath && props.receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction) : {}; + const {image: receiptImage, thumbnail: receiptThumbnail} = + props.receiptPath && props.receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction, props.receiptPath, props.receiptFilename) : {}; return ( Date: Wed, 18 Oct 2023 22:06:47 +0530 Subject: [PATCH 2/2] add jsdoc param and null for optional params --- src/libs/ReceiptUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts index 45bbd3a8350a..13e8a195cccb 100644 --- a/src/libs/ReceiptUtils.ts +++ b/src/libs/ReceiptUtils.ts @@ -24,8 +24,10 @@ type FileNameAndExtension = { * Grab the appropriate receipt image and thumbnail URIs based on file type * * @param transaction + * @param receiptPath + * @param receiptFileName */ -function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string, receiptFileName: string): ThumbnailAndImageURI { +function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string | null = null, receiptFileName: string | null = null): ThumbnailAndImageURI { // URI to image, i.e. blob:new.expensify.com/9ef3a018-4067-47c6-b29f-5f1bd35f213d or expensify.com/receipts/w_e616108497ef940b7210ec6beb5a462d01a878f4.jpg const path = transaction?.receipt?.source ?? receiptPath ?? ''; // filename of uploaded image or last part of remote URI