From 2acbd813a307a028fd574ba1132e06f9a2da397e Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Sun, 7 Jan 2024 19:29:25 +0100 Subject: [PATCH] Make sure not to show (none) in the modified expense message --- src/libs/ModifiedExpenseMessage.ts | 4 +++- src/pages/EditRequestMerchantPage.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/ModifiedExpenseMessage.ts b/src/libs/ModifiedExpenseMessage.ts index 600cfb48a1c1..61e7ce04ab71 100644 --- a/src/libs/ModifiedExpenseMessage.ts +++ b/src/libs/ModifiedExpenseMessage.ts @@ -38,8 +38,10 @@ function buildMessageFragmentForValue( const newValueToDisplay = valueInQuotes ? `"${newValue}"` : newValue; const oldValueToDisplay = valueInQuotes ? `"${oldValue}"` : oldValue; const displayValueName = shouldConvertToLowercase ? valueName.toLowerCase() : valueName; + const isOldValuePartialMerchant = valueName === Localize.translateLocal('common.merchant') && oldValue === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; - if (!oldValue) { + // In case of a partial merchant value, we want to avoid user seeing the "(none)" value in the message. + if (!oldValue || isOldValuePartialMerchant) { const fragment = Localize.translateLocal('iou.setTheRequest', {valueName: displayValueName, newValueToDisplay}); setFragments.push(fragment); } else if (!newValue) { diff --git a/src/pages/EditRequestMerchantPage.js b/src/pages/EditRequestMerchantPage.js index c8766d9acc67..e5966bad2d2b 100644 --- a/src/pages/EditRequestMerchantPage.js +++ b/src/pages/EditRequestMerchantPage.js @@ -27,7 +27,7 @@ function EditRequestMerchantPage({defaultMerchant, onSubmit, isPolicyExpenseChat const styles = useThemeStyles(); const {translate} = useLocalize(); const merchantInputRef = useRef(null); - const isEmptyMerchant = defaultMerchant === '' || defaultMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT || defaultMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; + const isEmptyMerchant = defaultMerchant === '' || defaultMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; const validate = useCallback( (value) => {