From 55cdc9af9e435a64c4322c0e05dc51cb4a8e5465 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Fri, 22 Mar 2024 23:10:05 +0300 Subject: [PATCH 01/12] applied refactor for report action message and copy to clipboard --- src/libs/ReportUtils.ts | 12 +-------- .../BaseReportActionContextMenu.tsx | 18 +++++++++++-- .../report/ContextMenu/ContextMenuActions.tsx | 7 +++--- .../home/report/ReportActionItemMessage.tsx | 25 +++++++++++++++---- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d0ce53a0e10b..0b24f71cc595 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2412,15 +2412,6 @@ function getLinkedTransaction(reportAction: OnyxEntry | EmptyObject { - return allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`] ?? {}; -} - /** * Given a parent IOU report action get report name for the LHN. */ @@ -5115,7 +5106,7 @@ function getVisibleMemberIDs(report: OnyxEntry): number[] { /** * Return iou report action display message */ -function getIOUReportActionDisplayMessage(reportAction: OnyxEntry): string { +function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, transaction?: OnyxEntry): string { if (reportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU) { return ''; } @@ -5145,7 +5136,6 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry) return Localize.translateLocal(translationKey, {amount: formattedAmount, payer: ''}); } - const transaction = getTransaction(originalMessage.IOUTransactionID ?? ''); const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : null); const formattedAmount = CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency); const isRequestSettled = isSettled(originalMessage.IOUReportID); diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx index 4a5948545345..48307a54f351 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -18,7 +18,7 @@ import * as ReportUtils from '@libs/ReportUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Beta, ReportAction, ReportActions} from '@src/types/onyx'; +import type {Beta, ReportAction, ReportActions, Transaction} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {ContextMenuAction, ContextMenuActionPayload} from './ContextMenuActions'; import ContextMenuActions from './ContextMenuActions'; @@ -31,6 +31,9 @@ type BaseReportActionContextMenuOnyxProps = { /** All of the actions of the report */ reportActions: OnyxEntry; + + /** The transaction linked to the report action this context menu is attached to. */ + transaction: OnyxEntry; }; type BaseReportActionContextMenuProps = BaseReportActionContextMenuOnyxProps & { @@ -106,6 +109,7 @@ function BaseReportActionContextMenu({ selection = '', draftMessage = '', reportActionID, + transaction, reportID, betas, reportActions, @@ -249,6 +253,7 @@ function BaseReportActionContextMenu({ textTranslateKey === 'reportActionContextMenu.deleteAction' || textTranslateKey === 'reportActionContextMenu.deleteConfirmation'; const text = textTranslateKey && (isKeyInActionUpdateKeys ? translate(textTranslateKey, {action: reportAction}) : translate(textTranslateKey)); + const transactionPayload = textTranslateKey === 'reportActionContextMenu.copyToClipboard' && transaction && {transaction}; return ( interceptAnonymousUser(() => contextAction.onPress?.(closePopup, {...payload, event}), contextAction.isAnonymousAction)} + onPress={(event) => + interceptAnonymousUser(() => contextAction.onPress?.(closePopup, {...payload, ...transactionPayload, event}), contextAction.isAnonymousAction) + } description={contextAction.getDescription?.(selection) ?? ''} isAnonymousAction={contextAction.isAnonymousAction} isFocused={focusedIndex === index} @@ -282,6 +289,13 @@ export default withOnyx `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, canEvict: false, }, + transaction: { + key: ({reportActions, reportActionID}) => { + const reportAction = reportActions?.[reportActionID]; + const originalMessage = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? reportAction.originalMessage : null; + return `${ONYXKEYS.COLLECTION.TRANSACTION}${originalMessage?.IOUTransactionID ?? 0}`; + }, + }, })( memo(BaseReportActionContextMenu, (prevProps, nextProps) => { const {reportActions: prevReportActions, ...prevPropsWithoutReportActions} = prevProps; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 0ac639d5367c..cdd545d8c8cc 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -27,7 +27,7 @@ import * as Report from '@userActions/Report'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; -import type {Beta, ReportAction, ReportActionReactions, Report as ReportType} from '@src/types/onyx'; +import type {Beta, ReportAction, ReportActionReactions, Report as ReportType, Transaction} from '@src/types/onyx'; import type IconAsset from '@src/types/utils/IconAsset'; import type {ContextMenuAnchor} from './ReportActionContextMenu'; import {hideContextMenu, showDeleteModal} from './ReportActionContextMenu'; @@ -65,6 +65,7 @@ type ShouldShow = ( type ContextMenuActionPayload = { reportAction: ReportAction; + transaction?: OnyxEntry; reportID: string; draftMessage: string; selection: string; @@ -339,7 +340,7 @@ const ContextMenuActions: ContextMenuAction[] = [ // If return value is true, we switch the `text` and `icon` on // `ContextMenuItem` with `successText` and `successIcon` which will fall back to // the `text` and `icon` - onPress: (closePopover, {reportAction, selection, reportID}) => { + onPress: (closePopover, {reportAction, transaction, selection, reportID}) => { const isReportPreviewAction = ReportActionsUtils.isReportPreviewAction(reportAction); const messageHtml = getActionHtml(reportAction); const messageText = ReportActionsUtils.getReportActionMessageText(reportAction); @@ -363,7 +364,7 @@ const ContextMenuActions: ContextMenuAction[] = [ const displayMessage = ReportUtils.getReimbursementDeQueuedActionMessage(reportAction, expenseReport); Clipboard.setString(displayMessage); } else if (ReportActionsUtils.isMoneyRequestAction(reportAction)) { - const displayMessage = ReportUtils.getIOUReportActionDisplayMessage(reportAction); + const displayMessage = ReportUtils.getIOUReportActionDisplayMessage(reportAction, transaction); Clipboard.setString(displayMessage); } else if (ReportActionsUtils.isCreatedTaskReportAction(reportAction)) { const taskPreviewMessage = TaskUtils.getTaskCreatedMessage(reportAction); diff --git a/src/pages/home/report/ReportActionItemMessage.tsx b/src/pages/home/report/ReportActionItemMessage.tsx index e7ac957a0800..becc7f9bcb6f 100644 --- a/src/pages/home/report/ReportActionItemMessage.tsx +++ b/src/pages/home/report/ReportActionItemMessage.tsx @@ -2,18 +2,26 @@ import type {ReactElement} from 'react'; import React from 'react'; import type {StyleProp, TextStyle, ViewStyle} from 'react-native'; import {View} from 'react-native'; +import {withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; -import type {ReportAction} from '@src/types/onyx'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type {ReportAction, Transaction} from '@src/types/onyx'; import type {OriginalMessageAddComment} from '@src/types/onyx/OriginalMessage'; import TextCommentFragment from './comment/TextCommentFragment'; import ReportActionItemFragment from './ReportActionItemFragment'; -type ReportActionItemMessageProps = { +type ReportActionItemMessageOnyxProps = { + /** The transaction linked to the report action. */ + transaction: OnyxEntry; +}; + +type ReportActionItemMessageProps = ReportActionItemMessageOnyxProps & { /** The report action */ action: ReportAction; @@ -30,7 +38,7 @@ type ReportActionItemMessageProps = { reportID: string; }; -function ReportActionItemMessage({action, displayAsGroup, reportID, style, isHidden = false}: ReportActionItemMessageProps) { +function ReportActionItemMessage({action, transaction, displayAsGroup, reportID, style, isHidden = false}: ReportActionItemMessageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -58,7 +66,7 @@ function ReportActionItemMessage({action, displayAsGroup, reportID, style, isHid const originalMessage = action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : null; const iouReportID = originalMessage?.IOUReportID; if (iouReportID) { - iouMessage = ReportUtils.getIOUReportActionDisplayMessage(action); + iouMessage = ReportUtils.getIOUReportActionDisplayMessage(action, transaction); } } @@ -115,4 +123,11 @@ function ReportActionItemMessage({action, displayAsGroup, reportID, style, isHid ReportActionItemMessage.displayName = 'ReportActionItemMessage'; -export default ReportActionItemMessage; +export default withOnyx({ + transaction: { + key: ({action}) => { + const originalMessage = action?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : null; + return `${ONYXKEYS.COLLECTION.TRANSACTION}${originalMessage?.IOUTransactionID ?? 0}`; + }, + }, +})(ReportActionItemMessage); From 1ff147ffb2c81e3e514647c55499b7b5b42e69c5 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Fri, 22 Mar 2024 23:15:13 +0300 Subject: [PATCH 02/12] fix performance test --- tests/perf-test/ReportUtils.perf-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/perf-test/ReportUtils.perf-test.ts b/tests/perf-test/ReportUtils.perf-test.ts index ae3429bb9c01..1e033bacfc4b 100644 --- a/tests/perf-test/ReportUtils.perf-test.ts +++ b/tests/perf-test/ReportUtils.perf-test.ts @@ -201,6 +201,6 @@ describe('ReportUtils', () => { }; await waitForBatchedUpdates(); - await measureFunction(() => ReportUtils.getIOUReportActionDisplayMessage(reportAction)); + await measureFunction(() => ReportUtils.getIOUReportActionDisplayMessage(reportAction, createRandomTransaction(1))); }); }); From 85d761b41854038aa99bd7c97b8134e05f801e52 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Sat, 23 Mar 2024 22:16:51 +0300 Subject: [PATCH 03/12] fix type --- .../report/ContextMenu/MiniReportActionContextMenu/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/types.ts b/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/types.ts index b7c3d6214094..b18c932fd7e2 100644 --- a/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/types.ts +++ b/src/pages/home/report/ContextMenu/MiniReportActionContextMenu/types.ts @@ -1,6 +1,6 @@ import type {BaseReportActionContextMenuProps} from '@pages/home/report/ContextMenu/BaseReportActionContextMenu'; -type MiniReportActionContextMenuProps = Omit & { +type MiniReportActionContextMenuProps = Omit & { /** Should the reportAction this menu is attached to have the appearance of being grouped with the previous reportAction? */ displayAsGroup?: boolean; }; From 5770ec3929e9fd68a024cb3eac4e5b711daa32c5 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 26 Mar 2024 14:07:00 +0300 Subject: [PATCH 04/12] remove transaction param for test --- tests/perf-test/ReportUtils.perf-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/perf-test/ReportUtils.perf-test.ts b/tests/perf-test/ReportUtils.perf-test.ts index 1e033bacfc4b..ae3429bb9c01 100644 --- a/tests/perf-test/ReportUtils.perf-test.ts +++ b/tests/perf-test/ReportUtils.perf-test.ts @@ -201,6 +201,6 @@ describe('ReportUtils', () => { }; await waitForBatchedUpdates(); - await measureFunction(() => ReportUtils.getIOUReportActionDisplayMessage(reportAction, createRandomTransaction(1))); + await measureFunction(() => ReportUtils.getIOUReportActionDisplayMessage(reportAction)); }); }); From e53277ebd310efa6562de953a08b0509449cd6dc Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 26 Mar 2024 22:57:51 +0300 Subject: [PATCH 05/12] add server logging code --- src/libs/ReportUtils.ts | 9 ++++++++- src/pages/home/report/ReportActionItemMessage.tsx | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 629af2b4abc3..3e5e2c07eb8b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -60,6 +60,7 @@ import isReportMessageAttachment from './isReportMessageAttachment'; import localeCompare from './LocaleCompare'; import * as LocalePhoneNumber from './LocalePhoneNumber'; import * as Localize from './Localize'; +import Log from './Log'; import {isEmailPublicDomain} from './LoginUtils'; import ModifiedExpenseMessage from './ModifiedExpenseMessage'; import linkingConfig from './Navigation/linkingConfig'; @@ -5111,7 +5112,7 @@ function getVisibleMemberIDs(report: OnyxEntry): number[] { /** * Return iou report action display message */ -function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, transaction?: OnyxEntry): string { +function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, transaction?: OnyxEntry, shouldLog = false): string { if (reportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU) { return ''; } @@ -5141,6 +5142,12 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, return Localize.translateLocal(translationKey, {amount: formattedAmount, payer: ''}); } + // This log to server is temporary and needed to determine if there is a case we need the transaction param + // when we call getIOUReportActionDisplayMessage from ReportActionItemMessage + if (shouldLog) { + Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', reportAction); + } + const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : null); const formattedAmount = CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency); const isRequestSettled = isSettled(originalMessage.IOUReportID); diff --git a/src/pages/home/report/ReportActionItemMessage.tsx b/src/pages/home/report/ReportActionItemMessage.tsx index becc7f9bcb6f..be6eda2409f3 100644 --- a/src/pages/home/report/ReportActionItemMessage.tsx +++ b/src/pages/home/report/ReportActionItemMessage.tsx @@ -66,7 +66,7 @@ function ReportActionItemMessage({action, transaction, displayAsGroup, reportID, const originalMessage = action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : null; const iouReportID = originalMessage?.IOUReportID; if (iouReportID) { - iouMessage = ReportUtils.getIOUReportActionDisplayMessage(action, transaction); + iouMessage = ReportUtils.getIOUReportActionDisplayMessage(action, transaction, true); } } From ad0e1b279edb45de8412cf4e297ca09bd91a7558 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 28 Mar 2024 21:19:55 +0300 Subject: [PATCH 06/12] use getLinkedTransactionID --- src/libs/ReportActionsUtils.ts | 6 +++--- src/libs/actions/ReportActions.ts | 2 +- src/pages/home/report/ReportActionItemMessage.tsx | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 43145dc3c7a1..f835196f606e 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -646,12 +646,12 @@ function getLatestReportActionFromOnyxData(onyxData: OnyxUpdate[] | null): OnyxE /** * Find the transaction associated with this reportAction, if one exists. */ -function getLinkedTransactionID(reportID: string, reportActionID: string): string | null { - const reportAction = allReportActions?.[reportID]?.[reportActionID]; +function getLinkedTransactionID(reportActionOrID: string | ReportAction, reportID?: string): string | null { + const reportAction = typeof reportActionOrID === 'string' ? allReportActions?.[reportID ?? '']?.[reportActionOrID] : reportActionOrID; if (!reportAction || reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU) { return null; } - return reportAction.originalMessage.IOUTransactionID ?? null; + return reportAction.originalMessage?.IOUTransactionID ?? null; } function getReportAction(reportID: string, reportActionID: string): OnyxEntry { diff --git a/src/libs/actions/ReportActions.ts b/src/libs/actions/ReportActions.ts index 66deb8aca065..ae886e0309dc 100644 --- a/src/libs/actions/ReportActions.ts +++ b/src/libs/actions/ReportActions.ts @@ -22,7 +22,7 @@ function clearReportActionErrors(reportID: string, reportAction: ReportAction, k }); // If there's a linked transaction, delete that too - const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(originalReportID ?? '', reportAction.reportActionID); + const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(reportAction.reportActionID, originalReportID ?? ''); if (linkedTransactionID) { Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null); } diff --git a/src/pages/home/report/ReportActionItemMessage.tsx b/src/pages/home/report/ReportActionItemMessage.tsx index be6eda2409f3..eec0b825e454 100644 --- a/src/pages/home/report/ReportActionItemMessage.tsx +++ b/src/pages/home/report/ReportActionItemMessage.tsx @@ -125,9 +125,6 @@ ReportActionItemMessage.displayName = 'ReportActionItemMessage'; export default withOnyx({ transaction: { - key: ({action}) => { - const originalMessage = action?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : null; - return `${ONYXKEYS.COLLECTION.TRANSACTION}${originalMessage?.IOUTransactionID ?? 0}`; - }, + key: ({action}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${ReportActionsUtils.getLinkedTransactionID(action) ?? 0}`, }, })(ReportActionItemMessage); From 72eb49bc115852ae5d9bd9d9448c57a9746652c8 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Fri, 29 Mar 2024 10:29:36 +0300 Subject: [PATCH 07/12] made code DRY --- src/libs/ReportActionsUtils.ts | 2 +- .../home/report/ContextMenu/BaseReportActionContextMenu.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f835196f606e..cd13c42a0f8d 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -646,7 +646,7 @@ function getLatestReportActionFromOnyxData(onyxData: OnyxUpdate[] | null): OnyxE /** * Find the transaction associated with this reportAction, if one exists. */ -function getLinkedTransactionID(reportActionOrID: string | ReportAction, reportID?: string): string | null { +function getLinkedTransactionID(reportActionOrID: string | OnyxEntry, reportID?: string): string | null { const reportAction = typeof reportActionOrID === 'string' ? allReportActions?.[reportID ?? '']?.[reportActionOrID] : reportActionOrID; if (!reportAction || reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU) { return null; diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx index ae5ef63dfca7..019ccaefeafb 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -14,6 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useStyleUtils from '@hooks/useStyleUtils'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import {getLinkedTransactionID} from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; @@ -300,8 +301,7 @@ export default withOnyx { const reportAction = reportActions?.[reportActionID]; - const originalMessage = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? reportAction.originalMessage : null; - return `${ONYXKEYS.COLLECTION.TRANSACTION}${originalMessage?.IOUTransactionID ?? 0}`; + return `${ONYXKEYS.COLLECTION.TRANSACTION}${(reportAction && getLinkedTransactionID(reportAction)) ?? 0}`; }, }, })( From 1102fd2ab27e3b7c8e73e0b06f1f908d9b168927 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Fri, 29 Mar 2024 15:05:12 +0300 Subject: [PATCH 08/12] fixed import --- .../home/report/ContextMenu/BaseReportActionContextMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx index 019ccaefeafb..07a894251fd4 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -14,7 +14,7 @@ import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useStyleUtils from '@hooks/useStyleUtils'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import {getLinkedTransactionID} from '@libs/ReportActionsUtils'; +import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; @@ -301,7 +301,7 @@ export default withOnyx { const reportAction = reportActions?.[reportActionID]; - return `${ONYXKEYS.COLLECTION.TRANSACTION}${(reportAction && getLinkedTransactionID(reportAction)) ?? 0}`; + return `${ONYXKEYS.COLLECTION.TRANSACTION}${(reportAction && ReportActionsUtils.getLinkedTransactionID(reportAction)) ?? 0}`; }, }, })( From 871eca66e8b47c735df7a845c26c05684a07d81a Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 1 Apr 2024 13:36:49 +0300 Subject: [PATCH 09/12] passed object of report action --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 7d50d7952cbd..405889340826 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5119,7 +5119,7 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, // This log to server is temporary and needed to determine if there is a case we need the transaction param // when we call getIOUReportActionDisplayMessage from ReportActionItemMessage if (shouldLog) { - Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', reportAction); + Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', {reportAction}); } const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : null); From 3badbd1e586f1e77dcc4c998ed59b15608d7da3b Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 2 Apr 2024 12:58:33 +0300 Subject: [PATCH 10/12] logged originalMessage --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 20b7081be8a1..1451d801b19e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5220,7 +5220,7 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, // This log to server is temporary and needed to determine if there is a case we need the transaction param // when we call getIOUReportActionDisplayMessage from ReportActionItemMessage if (shouldLog) { - Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', {reportAction}); + Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', {originalMessage}); } const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : null); From 79d84482d4d1d84047d73ab016fbe6c49e2af2aa Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 2 Apr 2024 18:05:59 +0300 Subject: [PATCH 11/12] logged only original message type --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1451d801b19e..e6816cba58ff 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5220,7 +5220,7 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, // This log to server is temporary and needed to determine if there is a case we need the transaction param // when we call getIOUReportActionDisplayMessage from ReportActionItemMessage if (shouldLog) { - Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', {originalMessage}); + Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', {originalMessageType: originalMessage.type}); } const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : null); From 338aeff5b65c2348b5882c3e8d48998110d8bd92 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 3 Apr 2024 12:20:43 +0300 Subject: [PATCH 12/12] logged reportActionID --- src/libs/ReportUtils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index e6816cba58ff..bd9bda427452 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5220,7 +5220,10 @@ function getIOUReportActionDisplayMessage(reportAction: OnyxEntry, // This log to server is temporary and needed to determine if there is a case we need the transaction param // when we call getIOUReportActionDisplayMessage from ReportActionItemMessage if (shouldLog) { - Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', {originalMessageType: originalMessage.type}); + Log.alert('Transaction Param Used when getIOUReportActionDisplayMessage was called from ReportActionItemMessage', { + reportActionID: reportAction.reportActionID, + originalMessageType: originalMessage.type, + }); } const transactionDetails = getTransactionDetails(!isEmptyObject(transaction) ? transaction : null);