Skip to content

Commit

Permalink
Merge pull request Expensify#34079 from Expensify/vit-updateOptimisti…
Browse files Browse the repository at this point in the history
…cMerchantChant

Make sure not to show (none) in the modified expense message
  • Loading branch information
rlinoz authored Jan 9, 2024
2 parents 4c063bc + 2acbd81 commit 0f867b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/libs/ModifiedExpenseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestMerchantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 0f867b8

Please sign in to comment.