From 894c836628d45f1c91bf15c9132c293edcbeafaa Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 8 Sep 2023 14:56:12 +0800 Subject: [PATCH 1/4] Update the paid message to use same language as the button --- src/languages/en.ts | 4 ++-- src/languages/es.ts | 4 ++-- src/languages/types.ts | 4 ++-- src/libs/ReportUtils.js | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index af7957e1a560..58e712a3e7cc 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -38,7 +38,7 @@ import type { SettledAfterAddedBankAccountParams, PaidElsewhereWithAmountParams, PaidUsingPaypalWithAmountParams, - PaidUsingExpensifyWithAmountParams, + PaidWithExpensifyWithAmountParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, SizeExceededParams, @@ -520,7 +520,7 @@ export default { `${submitterDisplayName} added a bank account. The ${amount} payment has been made.`, paidElsewhereWithAmount: ({amount}: PaidElsewhereWithAmountParams) => `paid ${amount} elsewhere`, paidUsingPaypalWithAmount: ({amount}: PaidUsingPaypalWithAmountParams) => `paid ${amount} using Paypal.me`, - paidUsingExpensifyWithAmount: ({amount}: PaidUsingExpensifyWithAmountParams) => `paid ${amount} using Expensify`, + paidWithExpensifyWithAmount: ({amount}: PaidWithExpensifyWithAmountParams) => `paid ${amount} with Expensify`, noReimbursableExpenses: 'This report has an invalid amount', pendingConversionMessage: "Total will update when you're back online", threadRequestReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${formattedAmount} request${comment ? ` for ${comment}` : ''}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index f950733b005c..a4369ebb4b46 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -38,7 +38,7 @@ import type { SettledAfterAddedBankAccountParams, PaidElsewhereWithAmountParams, PaidUsingPaypalWithAmountParams, - PaidUsingExpensifyWithAmountParams, + PaidWithExpensifyWithAmountParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, SizeExceededParams, @@ -521,7 +521,7 @@ export default { `${submitterDisplayName} añadió una cuenta bancaria. El pago de ${amount} se ha realizado.`, paidElsewhereWithAmount: ({amount}: PaidElsewhereWithAmountParams) => `pagó ${amount} de otra forma`, paidUsingPaypalWithAmount: ({amount}: PaidUsingPaypalWithAmountParams) => `pagó ${amount} con PayPal.me`, - paidUsingExpensifyWithAmount: ({amount}: PaidUsingExpensifyWithAmountParams) => `pagó ${amount} con Expensify`, + paidWithExpensifyWithAmount: ({amount}: PaidWithExpensifyWithAmountParams) => `pagó ${amount} con Expensify`, noReimbursableExpenses: 'El importe de este informe no es válido', pendingConversionMessage: 'El total se actualizará cuando estés online', threadRequestReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Solicitud de ${formattedAmount}${comment ? ` para ${comment}` : ''}`, diff --git a/src/languages/types.ts b/src/languages/types.ts index 50290fb5776c..ec25baee0126 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -126,7 +126,7 @@ type PaidElsewhereWithAmountParams = {amount: string}; type PaidUsingPaypalWithAmountParams = {amount: string}; -type PaidUsingExpensifyWithAmountParams = {amount: string}; +type PaidWithExpensifyWithAmountParams = {amount: string}; type ThreadRequestReportNameParams = {formattedAmount: string; comment: string}; @@ -223,7 +223,7 @@ export type { SettledAfterAddedBankAccountParams, PaidElsewhereWithAmountParams, PaidUsingPaypalWithAmountParams, - PaidUsingExpensifyWithAmountParams, + PaidWithExpensifyWithAmountParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, SizeExceededParams, diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 7390bac47dd1..4b86574c2645 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1447,12 +1447,12 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip } if (isSettled(report.reportID)) { - // A settled report preview message can come in three formats "paid ... using Paypal.me", "paid ... elsewhere" or "paid ... using Expensify" + // A settled report preview message can come in three formats "paid ... using Paypal.me", "paid ... elsewhere" or "paid ... with Expensify" let translatePhraseKey = 'iou.paidElsewhereWithAmount'; if (reportActionMessage.match(/ Paypal.me$/)) { translatePhraseKey = 'iou.paidUsingPaypalWithAmount'; - } else if (reportActionMessage.match(/ using Expensify$/)) { - translatePhraseKey = 'iou.paidUsingExpensifyWithAmount'; + } else if (reportActionMessage.match(/ (with Expensify|using Expensify)$/)) { + translatePhraseKey = 'iou.paidWithExpensifyWithAmount'; } return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount}); } From 2f05a5411b77e371fe617cbcd89305c9ab5f71c2 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 8 Sep 2023 16:07:22 +0800 Subject: [PATCH 2/4] Update copy --- src/libs/ReportUtils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 4b86574c2645..881a14d2b4fb 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2012,7 +2012,8 @@ function getIOUReportActionMessage(iouReportID, type, total, comment, currency, paymentMethodMessage = ' elsewhere'; break; case CONST.IOU.PAYMENT_TYPE.VBBA: - paymentMethodMessage = ' using Expensify'; + case CONST.IOU.PAYMENT_TYPE.EXPENSIFY: + paymentMethodMessage = ' with Expensify'; break; default: paymentMethodMessage = ` using ${paymentType}`; From 40cb0c0ab79908f2586076eb0e9e1e6d4705f12a Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 11 Sep 2023 21:33:53 +0800 Subject: [PATCH 3/4] Update the getReportPreviewMessage --- src/libs/ReportUtils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index ff8674756035..06640136c5e4 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1417,7 +1417,7 @@ function getTransactionReportName(reportAction) { * Get money request message for an IOU report * * @param {Object} report - * @param {Object} [reportAction={}] + * @param {Object} [reportAction={}] This can be either a report preview action or the IOU action * @param {Boolean} [shouldConsiderReceiptBeingScanned=false] * @returns {String} */ @@ -1449,9 +1449,9 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip if (isSettled(report.reportID)) { // A settled report preview message can come in three formats "paid ... using Paypal.me", "paid ... elsewhere" or "paid ... with Expensify" let translatePhraseKey = 'iou.paidElsewhereWithAmount'; - if (reportActionMessage.match(/ Paypal.me$/)) { + if (reportAction.originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.PAYPAL_ME || reportActionMessage.match(/ PayPal.me$/)) { translatePhraseKey = 'iou.paidUsingPaypalWithAmount'; - } else if (reportActionMessage.match(/ (with Expensify|using Expensify)$/)) { + } else if (_.contains([CONST.IOU.PAYMENT_TYPE.VBBA, CONST.IOU.PAYMENT_TYPE.EXPENSIFY], reportAction.originalMessage.paymentType) || reportActionMessage.match(/ (with Expensify|using Expensify)$/)) { translatePhraseKey = 'iou.paidWithExpensifyWithAmount'; } return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount}); From df42bd605ba3d77156e5e49464e976f918c1a736 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 11 Sep 2023 21:37:15 +0800 Subject: [PATCH 4/4] Run prettier --- src/libs/ReportUtils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 06640136c5e4..1221e1279558 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1451,7 +1451,10 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip let translatePhraseKey = 'iou.paidElsewhereWithAmount'; if (reportAction.originalMessage.paymentType === CONST.IOU.PAYMENT_TYPE.PAYPAL_ME || reportActionMessage.match(/ PayPal.me$/)) { translatePhraseKey = 'iou.paidUsingPaypalWithAmount'; - } else if (_.contains([CONST.IOU.PAYMENT_TYPE.VBBA, CONST.IOU.PAYMENT_TYPE.EXPENSIFY], reportAction.originalMessage.paymentType) || reportActionMessage.match(/ (with Expensify|using Expensify)$/)) { + } else if ( + _.contains([CONST.IOU.PAYMENT_TYPE.VBBA, CONST.IOU.PAYMENT_TYPE.EXPENSIFY], reportAction.originalMessage.paymentType) || + reportActionMessage.match(/ (with Expensify|using Expensify)$/) + ) { translatePhraseKey = 'iou.paidWithExpensifyWithAmount'; } return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount});