From 05b85b9641e2264be85bba054411b92edabdc7fb Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 25 Jul 2024 13:12:33 -0700 Subject: [PATCH 01/11] Add back in Forwarded action --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/languages/types.ts | 2 +- src/types/onyx/OldDotAction.ts | 23 ++++++++++++----------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1777d2e83d1b..edb91b726ed7 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3704,7 +3704,7 @@ export default { nonReimbursableLink: 'View company card expenses.', pending: ({label}: ExportedToIntegrationParams) => `started exporting this report to ${label}...`, }, - forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, + forwarded: ({to}: ForwardedParams) => `approved and forwarded this report to ${to}`, 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 23e959b25ef4..3cf4f1e604c2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3762,7 +3762,7 @@ 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}`, + forwarded: ({to}: ForwardedParams) => `aprobado e forwarded to ${to}`, 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 24117f257d8f..ea597365acc3 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -313,7 +313,7 @@ type DelegateSubmitParams = {delegateUser: string; originalManager: string}; type ExportedToIntegrationParams = {label: string}; -type ForwardedParams = {amount: string; currency: string}; +type ForwardedParams = {to: string}; type IntegrationsMessageParams = { label: string; diff --git a/src/types/onyx/OldDotAction.ts b/src/types/onyx/OldDotAction.ts index 66827eae4b6b..78fee288eae2 100644 --- a/src/types/onyx/OldDotAction.ts +++ b/src/types/onyx/OldDotAction.ts @@ -5,6 +5,7 @@ import type { ChangePolicyParams, DelegateSubmitParams, ExportedToIntegrationParams, + ForwardedParams, IntegrationsMessageParams, MarkReimbursedFromIntegrationParams, ShareParams, @@ -121,17 +122,16 @@ type OriginalMessageExportedToIntegration = { originalMessage: ExportedToIntegrationParams & Record; }; -// Currently lacking Params -// type OriginalMessagePolicyTask = { -// /** -// * -// */ -// actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; -// /** -// * -// */ -// originalMessage: ForwardedParams & Record; -// }; +type OriginalMessageForwarded = { + /** + * + */ + actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; + /** + * + */ + originalMessage: ForwardedParams & Record; +}; /** * @@ -466,6 +466,7 @@ export type { OriginalMessageDelegateSubmit, OriginalMessageExportedToCSV, OriginalMessageExportedToIntegration, + OriginalMessageForwarded, OriginalMessageIntegrationsMessage, OriginalMessageManagerAttachReceipt, OriginalMessageManagerDetachReceipt, From 76cee28502a6503b25f7ee8c83e7a20faa31f6b5 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 25 Jul 2024 13:12:55 -0700 Subject: [PATCH 02/11] Show forwarded report action --- src/libs/ReportActionsUtils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0bd5d096db7a..08199cf82212 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1225,6 +1225,9 @@ function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldD } case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: return Localize.translateLocal('report.actions.type.exportedToCSV'); + case CONST.REPORT.ACTIONS.TYPE.FORWARDED: + const {to} = originalMessage; + return Localize.translateLocal('report.actions.type.forwarded', {to}); case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: { const {result, label} = originalMessage; const errorMessage = result?.messages?.join(', ') ?? ''; From da6a3e888d9ecd96557e8ebcc58014b3ea642bab Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 12:51:27 -0700 Subject: [PATCH 03/11] Add forwarded message fn --- src/libs/OptionsListUtils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 033f92b914f1..29ff39d0ae91 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') { From 923cdfe9abf6fea6aed08effcb419ee1aab02ad9 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 12:51:53 -0700 Subject: [PATCH 04/11] Add get forwarded message --- src/libs/ReportUtils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 305bde1dc387..baa006ff6bb8 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.approvedAmount', {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) @@ -7418,6 +7422,7 @@ export { getIOUReportActionDisplayMessage, getIOUReportActionMessage, getIOUApprovedMessage, + getIOUForwardedMessage, getIOUSubmittedMessage, getIcons, getIconsForParticipants, From d6c8dcb339bbfc05450eaed9d52c9dc34dcf1700 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 12:54:35 -0700 Subject: [PATCH 05/11] Set message for forwarded action --- src/languages/en.ts | 3 ++- src/languages/es.ts | 3 ++- src/languages/types.ts | 3 +++ src/libs/ReportUtils.ts | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 166e859172c5..2361a7dbf849 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, @@ -744,6 +744,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) => diff --git a/src/languages/es.ts b/src/languages/es.ts index 2ff91784ad38..c1b25ea1dab6 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, @@ -740,6 +740,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) => diff --git a/src/languages/types.ts b/src/languages/types.ts index 318362c6c06d..8d8531d94a65 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}; @@ -372,6 +374,7 @@ export type { EnglishTranslation, EnterMagicCodeParams, FormattedMaxLengthParams, + ForwardedAmountParams, GoBackMessageParams, GoToRoomParams, HeldRequestParams, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index baa006ff6bb8..133f32e47a9b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4108,7 +4108,7 @@ function getIOUApprovedMessage(reportID: string) { } function getIOUForwardedMessage(reportID: string) { - return Localize.translateLocal('iou.approvedAmount', {amount: getFormattedAmount(reportID)}); + return Localize.translateLocal('iou.forwardedAmount', {amount: getFormattedAmount(reportID)}); } /** From e6333127a16d2c16d839ac75274d9f4ed4019ce3 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 12:55:59 -0700 Subject: [PATCH 06/11] Remove from olddot actions --- src/languages/en.ts | 1 - src/languages/es.ts | 1 - src/languages/types.ts | 3 --- src/types/onyx/OldDotAction.ts | 13 ------------- 4 files changed, 18 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 2361a7dbf849..4ccd5adaa1bc 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3709,7 +3709,6 @@ export default { nonReimbursableLink: 'View company card expenses.', pending: ({label}: ExportedToIntegrationParams) => `started exporting this report to ${label}...`, }, - forwarded: ({to}: ForwardedParams) => `approved and forwarded this report to ${to}`, 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 c1b25ea1dab6..173de546461d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3767,7 +3767,6 @@ export default { nonReimbursableLink: 'Ver los gastos de la tarjeta de empresa.', pending: ({label}: ExportedToIntegrationParams) => `comenzó a exportar este informe a ${label}...`, }, - forwarded: ({to}: ForwardedParams) => `aprobado e forwarded to ${to}`, 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 8d8531d94a65..2d6618aad1dd 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -315,8 +315,6 @@ type DelegateSubmitParams = {delegateUser: string; originalManager: string}; type ExportedToIntegrationParams = {label: string; markedManually?: boolean; inProgress?: boolean; lastModified?: string}; -type ForwardedParams = {to: string}; - type IntegrationsMessageParams = { label: string; result: { @@ -462,7 +460,6 @@ export type { ChangeTypeParams, ExportedToIntegrationParams, DelegateSubmitParams, - ForwardedParams, IntegrationsMessageParams, MarkedReimbursedParams, MarkReimbursedFromIntegrationParams, diff --git a/src/types/onyx/OldDotAction.ts b/src/types/onyx/OldDotAction.ts index 78fee288eae2..ec57634012ab 100644 --- a/src/types/onyx/OldDotAction.ts +++ b/src/types/onyx/OldDotAction.ts @@ -5,7 +5,6 @@ import type { ChangePolicyParams, DelegateSubmitParams, ExportedToIntegrationParams, - ForwardedParams, IntegrationsMessageParams, MarkReimbursedFromIntegrationParams, ShareParams, @@ -22,7 +21,6 @@ type OldDotOriginalMessageActionName = | 'DELEGATESUBMIT' | 'EXPORTCSV' | 'EXPORTINTEGRATION' - | 'FORWARDED' | 'INTEGRATIONSMESSAGE' | 'MANAGERATTACHRECEIPT' | 'MANAGERDETACHRECEIPT' @@ -122,17 +120,6 @@ type OriginalMessageExportedToIntegration = { originalMessage: ExportedToIntegrationParams & Record; }; -type OriginalMessageForwarded = { - /** - * - */ - actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; - /** - * - */ - originalMessage: ForwardedParams & Record; -}; - /** * */ From 9e02b3559bfc380929ad8afe328a89e716682e06 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 12:56:18 -0700 Subject: [PATCH 07/11] Remove olddot forwarded --- src/libs/ReportActionsUtils.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index c7bc30f1a715..8e9926648c2c 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1232,9 +1232,6 @@ function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldD } case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: return Localize.translateLocal('report.actions.type.exportedToCSV'); - case CONST.REPORT.ACTIONS.TYPE.FORWARDED: - const {to} = originalMessage; - return Localize.translateLocal('report.actions.type.forwarded', {to}); case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: { const {result, label} = originalMessage; const errorMessage = result?.messages?.join(', ') ?? ''; From 0ca339a8a844964482f541a52dac549693a5d462 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 13:02:23 -0700 Subject: [PATCH 08/11] remove that thing that i added --- src/types/onyx/OldDotAction.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/onyx/OldDotAction.ts b/src/types/onyx/OldDotAction.ts index ec57634012ab..a7ad789a3352 100644 --- a/src/types/onyx/OldDotAction.ts +++ b/src/types/onyx/OldDotAction.ts @@ -453,7 +453,6 @@ export type { OriginalMessageDelegateSubmit, OriginalMessageExportedToCSV, OriginalMessageExportedToIntegration, - OriginalMessageForwarded, OriginalMessageIntegrationsMessage, OriginalMessageManagerAttachReceipt, OriginalMessageManagerDetachReceipt, From b8e9776394bab089b3a0cb20990dd74f0da002c9 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 13:07:19 -0700 Subject: [PATCH 09/11] Add missing comma --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 173de546461d..91518398f5d3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -31,7 +31,7 @@ import type { EnterMagicCodeParams, ExportedToIntegrationParams, FormattedMaxLengthParams, - ForwardedAmountParams + ForwardedAmountParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, From 41f3b0c99fa0049dc862b75a1dc6fdbd9354127b Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 13:27:22 -0700 Subject: [PATCH 10/11] More style fixes and other fixes --- src/libs/ReportActionsUtils.ts | 1 - src/libs/ReportUtils.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/ReportActionItem.tsx | 2 ++ src/pages/home/report/ReportActionItemFragment.tsx | 1 + .../home/report/ReportActionsListItemRenderer.tsx | 2 +- src/types/onyx/OriginalMessage.ts | 14 +++++++++++++- 7 files changed, 23 insertions(+), 3 deletions(-) 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 133f32e47a9b..f80b7a1a3e14 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4143,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 = `approved ${amount}`; + break; case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: iouMessage = `unapproved ${amount}`; break; 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 e25c818d75be..912739363a0c 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -637,6 +637,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 7c0974f74a4b..05cb657b1e54 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..d6608b63f229 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -171,7 +171,7 @@ 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( + [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, ) } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 06b31f242989..beaa08555494 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -405,6 +405,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; +}; + /** * */ @@ -494,7 +506,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; /** */ From 575f433bc5abea40f192b2df98ed6d405ef2d6f1 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 29 Jul 2024 13:45:05 -0700 Subject: [PATCH 11/11] Use lib function & prettify --- src/libs/ReportUtils.ts | 2 +- .../home/report/ReportActionsListItemRenderer.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f80b7a1a3e14..c05107ac72fa 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4144,7 +4144,7 @@ function getIOUReportActionMessage(iouReportID: string, type: string, total: num iouMessage = `approved ${amount}`; break; case CONST.REPORT.ACTIONS.TYPE.FORWARDED: - iouMessage = `approved ${amount}`; + iouMessage = getIOUForwardedMessage(iouReportID); break; case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: iouMessage = `unapproved ${amount}`; diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index d6608b63f229..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, CONST.REPORT.ACTIONS.TYPE.FORWARDED].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}