diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 01b1cc7552b3..86f939edc1b5 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2155,7 +2155,7 @@ function getTransactionReportName(reportAction: OnyxEntry): string return Localize.translateLocal(ReportActionsUtils.isSentMoneyReportAction(reportAction) ? 'iou.threadSentMoneyReportName' : 'iou.threadRequestReportName', { formattedAmount: CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency, TransactionUtils.isDistanceRequest(transaction)) ?? '', - comment: transactionDetails?.comment ?? '', + comment: (!TransactionUtils.isMerchantMissing(transaction) ? transactionDetails?.merchant : transactionDetails?.comment) ?? '', }); } diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 1229e700d297..29c692b86709 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -141,11 +141,12 @@ function hasReceipt(transaction: Transaction | undefined | null): boolean { } function isMerchantMissing(transaction: Transaction) { + if (transaction.modifiedMerchant && transaction.modifiedMerchant !== '') { + return transaction.modifiedMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; + } const isMerchantEmpty = transaction.merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transaction.merchant === ''; - const isModifiedMerchantEmpty = !transaction.modifiedMerchant || transaction.modifiedMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transaction.modifiedMerchant === ''; - - return isMerchantEmpty && isModifiedMerchantEmpty; + return isMerchantEmpty; } /**