diff --git a/src/languages/en.ts b/src/languages/en.ts index 56d5a50af043..67354e7ea30a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -32,7 +32,7 @@ import type { EnterMagicCodeParams, ExportedToIntegrationParams, FormattedMaxLengthParams, - ForwardedParams, + ForwardedAmountParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, @@ -746,6 +746,7 @@ export default { managerApprovedAmount: ({manager, amount}: ManagerApprovedAmountParams) => `${manager} approved ${amount}`, payerSettled: ({amount}: PayerSettledParams) => `paid ${amount}`, approvedAmount: ({amount}: ApprovedAmountParams) => `approved ${amount}`, + forwardedAmount: ({amount}: ForwardedAmountParams) => `approved ${amount}`, waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up. Payment is on hold until ${submitterDisplayName} adds a bank account.`, adminCanceledRequest: ({manager, amount}: AdminCanceledRequestParams) => `${manager ? `${manager}: ` : ''}cancelled the ${amount} payment.`, canceledRequest: ({amount, submitterDisplayName}: CanceledRequestParams) => @@ -3724,7 +3725,6 @@ export default { nonReimbursableLink: 'View company card expenses.', pending: ({label}: ExportedToIntegrationParams) => `started exporting this report to ${label}...`, }, - forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, integrationsMessage: (errorMessage: string, label: string) => `failed to export this report to ${label} ("${errorMessage}").`, managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed a receipt`, diff --git a/src/languages/es.ts b/src/languages/es.ts index df2c062818c1..7a92d4d1217d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -31,7 +31,7 @@ import type { EnterMagicCodeParams, ExportedToIntegrationParams, FormattedMaxLengthParams, - ForwardedParams, + ForwardedAmountParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, @@ -742,6 +742,7 @@ export default { managerApprovedAmount: ({manager, amount}: ManagerApprovedAmountParams) => `${manager} aprobó ${amount}`, payerSettled: ({amount}: PayerSettledParams) => `pagó ${amount}`, approvedAmount: ({amount}: ApprovedAmountParams) => `aprobó ${amount}`, + forwardedAmount: ({amount}: ForwardedAmountParams) => `aprobó ${amount}`, waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inició el pago, pero no se procesará hasta que ${submitterDisplayName} añada una cuenta bancaria`, adminCanceledRequest: ({manager, amount}: AdminCanceledRequestParams) => `${manager ? `${manager}: ` : ''}canceló el pago de ${amount}.`, canceledRequest: ({amount, submitterDisplayName}: CanceledRequestParams) => @@ -3782,7 +3783,6 @@ export default { nonReimbursableLink: 'Ver los gastos de la tarjeta de empresa.', pending: ({label}: ExportedToIntegrationParams) => `comenzó a exportar este informe a ${label}...`, }, - forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`, integrationsMessage: (errorMessage: string, label: string) => `no se pudo exportar este informe a ${label} ("${errorMessage}").`, managerAttachReceipt: `agregó un recibo`, managerDetachReceipt: `quitó un recibo`, diff --git a/src/languages/types.ts b/src/languages/types.ts index c246864b3c03..b2e80ae3e973 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -123,6 +123,8 @@ type PayerPaidAmountParams = {payer?: string; amount: number | string}; type ApprovedAmountParams = {amount: number | string}; +type ForwardedAmountParams = {amount: number | string}; + type ManagerApprovedParams = {manager: string}; type ManagerApprovedAmountParams = {manager: string; amount: number | string}; @@ -313,8 +315,6 @@ type DelegateSubmitParams = {delegateUser: string; originalManager: string}; type ExportedToIntegrationParams = {label: string; markedManually?: boolean; inProgress?: boolean; lastModified?: string}; -type ForwardedParams = {amount: string; currency: string}; - type IntegrationsMessageParams = { label: string; result: { @@ -377,6 +377,7 @@ export type { EnglishTranslation, EnterMagicCodeParams, FormattedMaxLengthParams, + ForwardedAmountParams, GoBackMessageParams, GoToRoomParams, HeldRequestParams, @@ -465,7 +466,6 @@ export type { ChangeTypeParams, ExportedToIntegrationParams, DelegateSubmitParams, - ForwardedParams, IntegrationsMessageParams, MarkedReimbursedParams, MarkReimbursedFromIntegrationParams, diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 2fe9ea55a0ee..a2936e398ddd 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -749,6 +749,8 @@ function getLastMessageTextForReport(report: OnyxEntry, lastActorDetails lastMessageTextFromReport = ReportUtils.getIOUSubmittedMessage(reportID); } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { lastMessageTextFromReport = ReportUtils.getIOUApprovedMessage(reportID); + } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) { + lastMessageTextFromReport = ReportUtils.getIOUForwardedMessage(reportID); } else if (ReportActionUtils.isActionableAddPaymentCard(lastReportAction)) { lastMessageTextFromReport = ReportActionUtils.getReportActionMessageText(lastReportAction); } else if (lastReportAction?.actionName === 'EXPORTINTEGRATION') { diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 8e9926648c2c..39465c004b38 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1169,7 +1169,6 @@ function isOldDotReportAction(action: ReportAction | OldDotReportAction) { CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE, CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV, - CONST.REPORT.ACTIONS.TYPE.FORWARDED, CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE, CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT, CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1d2541659cf4..9bc7d9de01c3 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4107,6 +4107,10 @@ function getIOUApprovedMessage(reportID: string) { return Localize.translateLocal('iou.approvedAmount', {amount: getFormattedAmount(reportID)}); } +function getIOUForwardedMessage(reportID: string) { + return Localize.translateLocal('iou.forwardedAmount', {amount: getFormattedAmount(reportID)}); +} + /** * @param iouReportID - the report ID of the IOU report the action belongs to * @param type - IOUReportAction type. Can be oneOf(create, decline, cancel, pay, split) @@ -4139,6 +4143,9 @@ function getIOUReportActionMessage(iouReportID: string, type: string, total: num case CONST.REPORT.ACTIONS.TYPE.APPROVED: iouMessage = `approved ${amount}`; break; + case CONST.REPORT.ACTIONS.TYPE.FORWARDED: + iouMessage = getIOUForwardedMessage(iouReportID); + break; case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: iouMessage = `unapproved ${amount}`; break; @@ -7418,6 +7425,7 @@ export { getIOUReportActionDisplayMessage, getIOUReportActionMessage, getIOUApprovedMessage, + getIOUForwardedMessage, getIOUSubmittedMessage, getIcons, getIconsForParticipants, diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index b0a4d3d59d09..0faa14110eef 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -406,6 +406,9 @@ const ContextMenuActions: ContextMenuAction[] = [ } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { const displayMessage = ReportUtils.getIOUApprovedMessage(reportID); Clipboard.setString(displayMessage); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) { + const displayMessage = ReportUtils.getIOUForwardedMessage(reportID); + Clipboard.setString(displayMessage); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { Clipboard.setString(Localize.translateLocal('iou.heldExpense')); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) { diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 0cb9876b69f8..3b4c41b07eb4 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -638,6 +638,8 @@ function ReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) { diff --git a/src/pages/home/report/ReportActionItemFragment.tsx b/src/pages/home/report/ReportActionItemFragment.tsx index 088ee9eb2b6e..787904d72b81 100644 --- a/src/pages/home/report/ReportActionItemFragment.tsx +++ b/src/pages/home/report/ReportActionItemFragment.tsx @@ -69,6 +69,7 @@ const MUTED_ACTIONS = [ ...Object.values(CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG), CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.APPROVED, + CONST.REPORT.ACTIONS.TYPE.FORWARDED, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, CONST.REPORT.ACTIONS.TYPE.MOVED, CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_JOIN_REQUEST, diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index c57e02f1d0f1..48c578fd743a 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -171,9 +171,13 @@ function ReportActionsListItemRenderer({ shouldDisplayNewMarker={shouldDisplayNewMarker} shouldShowSubscriptAvatar={ ReportUtils.isPolicyExpenseChat(report) && - [CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW, CONST.REPORT.ACTIONS.TYPE.SUBMITTED, CONST.REPORT.ACTIONS.TYPE.APPROVED].some( - (type) => type === reportAction.actionName, - ) + [ + CONST.REPORT.ACTIONS.TYPE.IOU, + CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW, + CONST.REPORT.ACTIONS.TYPE.SUBMITTED, + CONST.REPORT.ACTIONS.TYPE.APPROVED, + CONST.REPORT.ACTIONS.TYPE.FORWARDED, + ].some((type) => type === reportAction.actionName) } isMostRecentIOUReportAction={reportAction.reportActionID === mostRecentIOUReportActionID} index={index} diff --git a/src/types/onyx/OldDotAction.ts b/src/types/onyx/OldDotAction.ts index 66827eae4b6b..a7ad789a3352 100644 --- a/src/types/onyx/OldDotAction.ts +++ b/src/types/onyx/OldDotAction.ts @@ -21,7 +21,6 @@ type OldDotOriginalMessageActionName = | 'DELEGATESUBMIT' | 'EXPORTCSV' | 'EXPORTINTEGRATION' - | 'FORWARDED' | 'INTEGRATIONSMESSAGE' | 'MANAGERATTACHRECEIPT' | 'MANAGERDETACHRECEIPT' @@ -121,18 +120,6 @@ type OriginalMessageExportedToIntegration = { originalMessage: ExportedToIntegrationParams & Record; }; -// Currently lacking Params -// type OriginalMessagePolicyTask = { -// /** -// * -// */ -// actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; -// /** -// * -// */ -// originalMessage: ForwardedParams & Record; -// }; - /** * */ diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 27a3e292e1d7..e70629782e2a 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -411,6 +411,18 @@ type OriginalMessageApproved = { expenseReportID: string; }; +/** Model of `forwarded` report action */ +type OriginalMessageForwarded = { + /** Forwarded expense amount */ + amount: number; + + /** Currency of the forwarded expense amount */ + currency: string; + + /** Report ID of the expense */ + expenseReportID: string; +}; + /** * */ @@ -500,7 +512,7 @@ type OriginalMessageMap = { /** */ [CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION]: OriginalMessageExportIntegration; /** */ - [CONST.REPORT.ACTIONS.TYPE.FORWARDED]: never; + [CONST.REPORT.ACTIONS.TYPE.FORWARDED]: OriginalMessageForwarded; /** */ [CONST.REPORT.ACTIONS.TYPE.HOLD]: never; /** */