From c7ce3e09254f80dfbfef6fdae75ecbc8314c3eaf Mon Sep 17 00:00:00 2001 From: Huzaifa Rasheed Date: Tue, 29 Aug 2023 12:33:53 +0500 Subject: [PATCH 1/6] Copy email with text when iou message is copied --- src/languages/en.js | 6 +++--- src/languages/es.js | 6 +++--- src/libs/OptionsListUtils.js | 2 +- src/libs/ReportUtils.js | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/languages/en.js b/src/languages/en.js index fa8ea84c141b..464e6c66a994 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -432,9 +432,9 @@ export default { payerSettled: ({amount}) => `paid ${amount}`, waitingOnBankAccount: ({submitterDisplayName}) => `started settling up, payment is held until ${submitterDisplayName} adds a bank account`, settledAfterAddedBankAccount: ({submitterDisplayName, amount}) => `${submitterDisplayName} added a bank account. The ${amount} payment has been made.`, - paidElsewhereWithAmount: ({amount}) => `paid ${amount} elsewhere`, - paidUsingPaypalWithAmount: ({amount}) => `paid ${amount} using Paypal.me`, - paidUsingExpensifyWithAmount: ({amount}) => `paid ${amount} using Expensify`, + paidElsewhereWithAmount: ({payer, amount}) => `${payer ? `${payer} ` : ''}paid ${amount} elsewhere`, + paidUsingPaypalWithAmount: ({payer, amount}) => `${payer ? `${payer} ` : ''}paid ${amount} using Paypal.me`, + paidUsingExpensifyWithAmount: ({payer, amount}) => `${payer ? `${payer} ` : ''}paid ${amount} using Expensify`, noReimbursableExpenses: 'This report has an invalid amount', pendingConversionMessage: "Total will update when you're back online", threadRequestReportName: ({formattedAmount, comment}) => `${formattedAmount} request${comment ? ` for ${comment}` : ''}`, diff --git a/src/languages/es.js b/src/languages/es.js index fd6fcd9b767f..f5af3e8c52eb 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -431,9 +431,9 @@ export default { payerSettled: ({amount}) => `pagó ${amount}`, waitingOnBankAccount: ({submitterDisplayName}) => `inicio el pago, pero no se procesará hasta que ${submitterDisplayName} añada una cuenta bancaria`, settledAfterAddedBankAccount: ({submitterDisplayName, amount}) => `${submitterDisplayName} añadió una cuenta bancaria. El pago de ${amount} se ha realizado.`, - paidElsewhereWithAmount: ({amount}) => `pagó ${amount} de otra forma`, - paidUsingPaypalWithAmount: ({amount}) => `pagó ${amount} con PayPal.me`, - paidUsingExpensifyWithAmount: ({amount}) => `pagó ${amount} con Expensify`, + paidElsewhereWithAmount: ({payer, amount}) => `${payer ? `${payer} ` : ''}pagó ${amount} de otra forma`, + paidUsingPaypalWithAmount: ({payer, amount}) => `${payer ? `${payer} ` : ''}pagó ${amount} con PayPal.me`, + paidUsingExpensifyWithAmount: ({payer, amount}) => `${payer ? `${payer} ` : ''}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}) => `Solicitud de ${formattedAmount}${comment ? ` para ${comment}` : ''}`, diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 72adae70e874..bacf73ec34de 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -385,7 +385,7 @@ function getLastMessageTextForReport(report) { lastMessageTextFromReport = `[${Localize.translateLocal(report.lastMessageTranslationKey || 'common.attachment')}]`; } else if (ReportActionUtils.isReportPreviewAction(lastReportAction)) { const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(lastReportAction)); - lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction); + lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction, false); } else if (ReportActionUtils.isModifiedExpenseAction(lastReportAction)) { lastMessageTextFromReport = ReportUtils.getModifiedExpenseMessage(lastReportAction); } else { diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index d41a31c5bae7..b2d7a58f71ee 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1387,9 +1387,10 @@ function getTransactionReportName(reportAction) { * * @param {Object} report * @param {Object} [reportAction={}] + * @param {Boolean} shouldShowEmailForSettledIOU * @returns {String} */ -function getReportPreviewMessage(report, reportAction = {}) { +function getReportPreviewMessage(report, reportAction = {}, shouldShowEmailForSettledIOU = true) { const reportActionMessage = lodashGet(reportAction, 'message[0].html', ''); if (_.isEmpty(report) || !report.reportID) { @@ -1414,7 +1415,7 @@ function getReportPreviewMessage(report, reportAction = {}) { } else if (reportActionMessage.match(/ using Expensify$/)) { translatePhraseKey = 'iou.paidUsingExpensifyWithAmount'; } - return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount}); + return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount, payer: shouldShowEmailForSettledIOU && payerName}); } if (report.isWaitingOnBankAccount) { From 2e3f86b0b6a6878304fe7c5070176a1e883fecb4 Mon Sep 17 00:00:00 2001 From: Huzaifa Rasheed Date: Mon, 11 Sep 2023 13:07:41 +0500 Subject: [PATCH 2/6] Fix lint --- src/libs/ReportUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 2b13a33b6938..46d7fbdb13ee 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1419,6 +1419,7 @@ function getTransactionReportName(reportAction) { * @param {Object} report * @param {Object} [reportAction={}] * @param {Boolean} [shouldConsiderReceiptBeingScanned=false] + * @param {Boolean} [shouldShowEmailForSettledIOU=true] * @returns {String} */ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceiptBeingScanned = false, shouldShowEmailForSettledIOU = true) { From 3816507cb837de83a652657fb110c1591083dc7c Mon Sep 17 00:00:00 2001 From: Huzaifa Rasheed Date: Wed, 13 Sep 2023 16:04:30 +0500 Subject: [PATCH 3/6] Show payer name for paid iou/expense msg in LHN --- src/languages/en.ts | 6 +++--- src/languages/es.ts | 6 +++--- src/libs/OptionsListUtils.js | 2 +- src/libs/ReportUtils.js | 5 ++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 4e2b000f280a..fb73601d48ff 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -532,9 +532,9 @@ export default { waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up, payment is held until ${submitterDisplayName} adds a bank account`, settledAfterAddedBankAccount: ({submitterDisplayName, amount}: SettledAfterAddedBankAccountParams) => `${submitterDisplayName} added a bank account. The ${amount} payment has been made.`, - paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer ? `${payer} ` : ''}paid ${amount} elsewhere`, - paidUsingPaypalWithAmount: ({payer, amount}: PaidUsingPaypalWithAmountParams) => `${payer ? `${payer} ` : ''}paid ${amount} using Paypal.me`, - paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer ? `${payer} ` : ''}paid ${amount} using Expensify`, + paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer} paid ${amount} elsewhere`, + paidUsingPaypalWithAmount: ({payer, amount}: PaidUsingPaypalWithAmountParams) => `${payer} paid ${amount} using Paypal.me`, + paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer} paid ${amount} using Expensify`, noReimbursableExpenses: 'This report has an invalid amount', pendingConversionMessage: "Total will update when you're back online", changedTheRequest: 'changed the request', diff --git a/src/languages/es.ts b/src/languages/es.ts index 19b78513e74d..8230d8819e73 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -524,9 +524,9 @@ export default { waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inicio el pago, pero no se procesará hasta que ${submitterDisplayName} añada una cuenta bancaria`, settledAfterAddedBankAccount: ({submitterDisplayName, amount}: SettledAfterAddedBankAccountParams) => `${submitterDisplayName} añadió una cuenta bancaria. El pago de ${amount} se ha realizado.`, - paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer ? `${payer} ` : ''}pagó ${amount} de otra forma`, - paidUsingPaypalWithAmount: ({payer, amount}: PaidUsingPaypalWithAmountParams) => `${payer ? `${payer} ` : ''}pagó ${amount} con PayPal.me`, - paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer ? `${payer} ` : ''}pagó ${amount} con Expensify`, + paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer} pagó ${amount} de otra forma`, + paidUsingPaypalWithAmount: ({payer, amount}: PaidUsingPaypalWithAmountParams) => `${payer} pagó ${amount} con PayPal.me`, + paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer} pagó ${amount} con Expensify`, noReimbursableExpenses: 'El importe de este informe no es válido', pendingConversionMessage: 'El total se actualizará cuando estés online', changedTheRequest: 'cambió la solicitud', diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 62e61eb81b1e..e53fa9a32712 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -397,7 +397,7 @@ function getLastMessageTextForReport(report) { lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(report, lastReportAction, true); } else if (ReportActionUtils.isReportPreviewAction(lastReportAction)) { const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(lastReportAction)); - lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction, false, false); + lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction, false); } else if (ReportActionUtils.isModifiedExpenseAction(lastReportAction)) { lastMessageTextFromReport = ReportUtils.getModifiedExpenseMessage(lastReportAction); } else { diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 6b5fb5824b9a..358c27ce8787 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1418,10 +1418,9 @@ function getTransactionReportName(reportAction) { * @param {Object} report * @param {Object} [reportAction={}] This can be either a report preview action or the IOU action * @param {Boolean} [shouldConsiderReceiptBeingScanned=false] - * @param {Boolean} [shouldShowEmailForSettledIOU=true] * @returns {String} */ -function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceiptBeingScanned = false, shouldShowEmailForSettledIOU = true) { +function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceiptBeingScanned = false) { const reportActionMessage = lodashGet(reportAction, 'message[0].html', ''); if (_.isEmpty(report) || !report.reportID) { @@ -1457,7 +1456,7 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip ) { translatePhraseKey = 'iou.paidWithExpensifyWithAmount'; } - return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount, payer: shouldShowEmailForSettledIOU && payerName}); + return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount, payer: payerName}); } if (report.isWaitingOnBankAccount) { From f532680f3f919470dc4169673e82d6932f2eab4b Mon Sep 17 00:00:00 2001 From: Huzaifa Rasheed Date: Wed, 13 Sep 2023 16:08:56 +0500 Subject: [PATCH 4/6] Removed payer as option param for translate messgae --- src/languages/types.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/languages/types.ts b/src/languages/types.ts index 84f2f0f61bb4..62f4b282ca3a 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -124,11 +124,11 @@ type WaitingOnBankAccountParams = {submitterDisplayName: string}; type SettledAfterAddedBankAccountParams = {submitterDisplayName: string; amount: string}; -type PaidElsewhereWithAmountParams = {payer?: string; amount: number}; +type PaidElsewhereWithAmountParams = {payer: string; amount: number}; -type PaidUsingPaypalWithAmountParams = {payer?: string; amount: string}; +type PaidUsingPaypalWithAmountParams = {payer: string; amount: string}; -type PaidWithExpensifyWithAmountParams = {payer?: string; amount: string}; +type PaidWithExpensifyWithAmountParams = {payer: string; amount: string}; type ThreadRequestReportNameParams = {formattedAmount: string; comment: string}; From 96a2a1f258f1e80d3488926524100d21fc605592 Mon Sep 17 00:00:00 2001 From: Huzaifa Rasheed Date: Wed, 13 Sep 2023 16:11:06 +0500 Subject: [PATCH 5/6] Removed unnecessary default param arg --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index e53fa9a32712..7629a1acc0a6 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -397,7 +397,7 @@ function getLastMessageTextForReport(report) { lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(report, lastReportAction, true); } else if (ReportActionUtils.isReportPreviewAction(lastReportAction)) { const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(lastReportAction)); - lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction, false); + lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction); } else if (ReportActionUtils.isModifiedExpenseAction(lastReportAction)) { lastMessageTextFromReport = ReportUtils.getModifiedExpenseMessage(lastReportAction); } else { From ef0781752b5a4c5bff007800a03daf645f8583ba Mon Sep 17 00:00:00 2001 From: Huzaifa Rasheed Date: Thu, 14 Sep 2023 02:17:22 +0500 Subject: [PATCH 6/6] Use correct type --- src/languages/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/types.ts b/src/languages/types.ts index 62f4b282ca3a..aefbd03dfd4e 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -124,7 +124,7 @@ type WaitingOnBankAccountParams = {submitterDisplayName: string}; type SettledAfterAddedBankAccountParams = {submitterDisplayName: string; amount: string}; -type PaidElsewhereWithAmountParams = {payer: string; amount: number}; +type PaidElsewhereWithAmountParams = {payer: string; amount: string}; type PaidUsingPaypalWithAmountParams = {payer: string; amount: string};