From 46381d737ab26b12be2cd60651de4193c32dc767 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 8 Jan 2025 16:27:23 +0100 Subject: [PATCH 1/7] Remove Approve button when trip will be paid at the hotel --- src/libs/ReportUtils.ts | 2 +- src/libs/actions/IOU.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9c6377474e78..d31530d9f209 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1770,7 +1770,7 @@ function isOneTransactionReport(reportID: string | undefined): boolean { /* * Whether the report contains only one expense and the expense should be paid later */ -function isPayAtEndExpenseReport(reportID: string, transactions: Transaction[] | undefined): boolean { +function isPayAtEndExpenseReport(reportID: string | undefined, transactions: Transaction[] | undefined): boolean { if ((!!transactions && transactions.length !== 1) || !isOneTransactionReport(reportID)) { return false; } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index ee49b1c8e803..dc1731c8ed3c 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7325,8 +7325,9 @@ function canApproveIOU( isTransactionBeingScanned = true; } } + const isPayAtEndExpenseReport = ReportUtils.isPayAtEndExpenseReport(iouReport?.reportID, reportTransactions); - return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !isTransactionBeingScanned; + return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !isTransactionBeingScanned && !isPayAtEndExpenseReport; } function canIOUBePaid( @@ -7384,6 +7385,7 @@ function canIOUBePaid( const shouldBeApproved = canApproveIOU(iouReport, policy); const isPayAtEndExpenseReport = ReportUtils.isPayAtEndExpenseReport(iouReport?.reportID, transactions); + return ( isPayer && !isOpenExpenseReport && From 09ce11eb14fc00e19ec71132559a468e1968e4e4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 8 Jan 2025 16:27:45 +0100 Subject: [PATCH 2/7] Move TripSummary to a separate component --- .../report/ReportActionItemParentAction.tsx | 70 ++++++++----------- .../report/ReportActionsListItemRenderer.tsx | 53 +++++++++----- src/pages/home/report/TripSummary.tsx | 35 ++++++++++ 3 files changed, 99 insertions(+), 59 deletions(-) create mode 100644 src/pages/home/report/TripSummary.tsx diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx index 5976ac5de725..18cb12098aa0 100644 --- a/src/pages/home/report/ReportActionItemParentAction.tsx +++ b/src/pages/home/report/ReportActionItemParentAction.tsx @@ -3,7 +3,6 @@ import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {useOnyx} from 'react-native-onyx'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; -import TripDetailsView from '@components/ReportActionItem/TripDetailsView'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; @@ -124,46 +123,37 @@ function ReportActionItemParentAction({ ancestor={ancestor} isLinkDisabled={!ReportUtils.canCurrentUserOpenReport(ancestorReports.current?.[ancestor?.report?.reportID ?? '-1'])} /> - {ReportActionsUtils.isTripPreview(ancestor?.reportAction) ? ( - - - - ) : ( - { - const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible( - ancestor.reportAction, - ancestor.reportAction.reportActionID ?? '-1', - canUserPerformWriteAction, - ); - // Pop the thread report screen before navigating to the chat report. - Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID ?? '-1')); - if (isVisibleAction && !isOffline) { - // Pop the chat report screen before navigating to the linked report action. - Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID ?? '-1', ancestor.reportAction.reportActionID)); - } + { + const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible( + ancestor.reportAction, + ancestor.reportAction.reportActionID ?? '-1', + canUserPerformWriteAction, + ); + // Pop the thread report screen before navigating to the chat report. + Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID ?? '-1')); + if (isVisibleAction && !isOffline) { + // Pop the chat report screen before navigating to the linked report action. + Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID ?? '-1', ancestor.reportAction.reportActionID)); } - : undefined - } - parentReportAction={parentReportAction} - report={ancestor.report} - reportActions={reportActions} - transactionThreadReport={transactionThreadReport} - action={ancestor.reportAction} - displayAsGroup={false} - isMostRecentIOUReportAction={false} - shouldDisplayNewMarker={ancestor.shouldDisplayNewMarker} - index={index} - isFirstVisibleReportAction={isFirstVisibleReportAction} - shouldUseThreadDividerLine={shouldUseThreadDividerLine} - isThreadReportParentAction - /> - )} + } + : undefined + } + parentReportAction={parentReportAction} + report={ancestor.report} + reportActions={reportActions} + transactionThreadReport={transactionThreadReport} + action={ancestor.reportAction} + displayAsGroup={false} + isMostRecentIOUReportAction={false} + shouldDisplayNewMarker={ancestor.shouldDisplayNewMarker} + index={index} + isFirstVisibleReportAction={isFirstVisibleReportAction} + shouldUseThreadDividerLine={shouldUseThreadDividerLine} + isThreadReportParentAction + /> ); })} diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index 63b2cb43d836..5a1b9f0bef6d 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -6,6 +6,7 @@ import CONST from '@src/CONST'; import type {Report, ReportAction} from '@src/types/onyx'; import ReportActionItem from './ReportActionItem'; import ReportActionItemParentAction from './ReportActionItemParentAction'; +import TripSummary from './TripSummary'; type ReportActionsListItemRendererProps = { /** All the data of the action item */ @@ -71,12 +72,8 @@ function ReportActionsListItemRenderer({ shouldUseThreadDividerLine = false, parentReportActionForTransactionThread, }: ReportActionsListItemRendererProps) { - const shouldDisplayParentAction = - reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && - ReportUtils.isChatThread(report) && - (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); - const originalMessage = useMemo(() => ReportActionsUtils.getOriginalMessage(reportAction), [reportAction]); + /** * Create a lightweight ReportAction so as to keep the re-rendering as light as possible by * passing in only the required props. @@ -145,20 +142,38 @@ function ReportActionsListItemRenderer({ ], ); - return shouldDisplayParentAction ? ( - - ) : ( + const shouldDisplayTripSummary = + reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && + ReportUtils.isTripRoom(report) && + (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); + + if (shouldDisplayTripSummary) { + return ; + } + + const shouldDisplayParentAction = + reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && + ReportUtils.isChatThread(report) && + (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); + + if (shouldDisplayParentAction) { + return ( + + ); + } + + return ( ; +}; + +function TripSummary({report}: TripSummaryProps) { + const styles = useThemeStyles(); + + return ( + + + + + + + + ); +} + +TripSummary.displayName = 'TripSummary'; + +export default TripSummary; From 544e50bdb11edaa1d8363578a9a9a4d38bede091 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 9 Jan 2025 12:39:40 +0100 Subject: [PATCH 3/7] Fix lint --- .../ReportActionItem/TripDetailsView.tsx | 20 +++++++++++-------- .../report/ReportActionItemParentAction.tsx | 10 +++++----- src/pages/home/report/TripSummary.tsx | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/components/ReportActionItem/TripDetailsView.tsx b/src/components/ReportActionItem/TripDetailsView.tsx index a7fdef547bf9..a09e14fe11c4 100644 --- a/src/components/ReportActionItem/TripDetailsView.tsx +++ b/src/components/ReportActionItem/TripDetailsView.tsx @@ -20,14 +20,6 @@ import * as TripReservationUtils from '@src/libs/TripReservationUtils'; import ROUTES from '@src/ROUTES'; import type {Reservation, ReservationTimeDetails} from '@src/types/onyx/Transaction'; -type TripDetailsViewProps = { - /** The active tripRoomReportID, used for Onyx subscription */ - tripRoomReportID: string; - - /** Whether we should display the horizontal rule below the component */ - shouldShowHorizontalRule: boolean; -}; - type ReservationViewProps = { reservation: Reservation; transactionID: string; @@ -142,10 +134,22 @@ function ReservationView({reservation, transactionID, tripRoomReportID, reservat ); } +type TripDetailsViewProps = { + /** The active tripRoomReportID, used for Onyx subscription */ + tripRoomReportID?: string; + + /** Whether we should display the horizontal rule below the component */ + shouldShowHorizontalRule: boolean; +}; + function TripDetailsView({tripRoomReportID, shouldShowHorizontalRule}: TripDetailsViewProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + if (!tripRoomReportID) { + return null; + } + const tripTransactions = ReportUtils.getTripTransactions(tripRoomReportID); const reservationsData: TripReservationUtils.ReservationData[] = TripReservationUtils.getReservationsFromTripTransactions(tripTransactions); diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx index 18cb12098aa0..6c904d0819fd 100644 --- a/src/pages/home/report/ReportActionItemParentAction.tsx +++ b/src/pages/home/report/ReportActionItemParentAction.tsx @@ -121,22 +121,22 @@ function ReportActionItemParentAction({ > { const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible( ancestor.reportAction, - ancestor.reportAction.reportActionID ?? '-1', + ancestor.reportAction.reportActionID, canUserPerformWriteAction, ); // Pop the thread report screen before navigating to the chat report. - Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID ?? '-1')); + Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID)); if (isVisibleAction && !isOffline) { // Pop the chat report screen before navigating to the linked report action. - Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID ?? '-1', ancestor.reportAction.reportActionID)); + Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID, ancestor.reportAction.reportActionID)); } } : undefined diff --git a/src/pages/home/report/TripSummary.tsx b/src/pages/home/report/TripSummary.tsx index 016c8407be73..750e760c1eb7 100644 --- a/src/pages/home/report/TripSummary.tsx +++ b/src/pages/home/report/TripSummary.tsx @@ -21,7 +21,7 @@ function TripSummary({report}: TripSummaryProps) { From 76dee3ed60912570ff8243345452f623a082ee6d Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 9 Jan 2025 12:42:01 +0100 Subject: [PATCH 4/7] Refactor ReportActionsListItemRenderer to clarify action display logic for trip summaries and parent actions --- .../home/report/ReportActionsListItemRenderer.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index 5a1b9f0bef6d..1c01b948f2b7 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -142,21 +142,15 @@ function ReportActionsListItemRenderer({ ], ); - const shouldDisplayTripSummary = + const shouldDisplayParentAction = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && - ReportUtils.isTripRoom(report) && (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); - if (shouldDisplayTripSummary) { + if (shouldDisplayParentAction && ReportUtils.isTripRoom(report)) { return ; } - const shouldDisplayParentAction = - reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && - ReportUtils.isChatThread(report) && - (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); - - if (shouldDisplayParentAction) { + if (shouldDisplayParentAction && ReportUtils.isChatThread(report)) { return ( Date: Thu, 9 Jan 2025 14:52:48 +0100 Subject: [PATCH 5/7] Enhance trip summary display logic in ReportActionsListItemRenderer --- src/pages/home/report/ReportActionsListItemRenderer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index 1c01b948f2b7..696691ee23b8 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -146,7 +146,10 @@ function ReportActionsListItemRenderer({ reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); - if (shouldDisplayParentAction && ReportUtils.isTripRoom(report)) { + const tripTransactions = ReportUtils.getTripTransactions(report?.reportID); + const shouldDisplayTripSummary = shouldDisplayParentAction && ReportUtils.isTripRoom(report) && tripTransactions.length > 0; + + if (shouldDisplayTripSummary) { return ; } From 78ea5b7bb080bba1d7ac080073a52236ef1af481 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 14 Jan 2025 16:40:20 +0100 Subject: [PATCH 6/7] refactor: enforce tripRoomReportID as a required prop and simplify null checks --- src/components/ReportActionItem/TripDetailsView.tsx | 6 +----- src/pages/home/report/TripSummary.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/ReportActionItem/TripDetailsView.tsx b/src/components/ReportActionItem/TripDetailsView.tsx index a09e14fe11c4..e4137f74c276 100644 --- a/src/components/ReportActionItem/TripDetailsView.tsx +++ b/src/components/ReportActionItem/TripDetailsView.tsx @@ -136,7 +136,7 @@ function ReservationView({reservation, transactionID, tripRoomReportID, reservat type TripDetailsViewProps = { /** The active tripRoomReportID, used for Onyx subscription */ - tripRoomReportID?: string; + tripRoomReportID: string; /** Whether we should display the horizontal rule below the component */ shouldShowHorizontalRule: boolean; @@ -146,10 +146,6 @@ function TripDetailsView({tripRoomReportID, shouldShowHorizontalRule}: TripDetai const styles = useThemeStyles(); const {translate} = useLocalize(); - if (!tripRoomReportID) { - return null; - } - const tripTransactions = ReportUtils.getTripTransactions(tripRoomReportID); const reservationsData: TripReservationUtils.ReservationData[] = TripReservationUtils.getReservationsFromTripTransactions(tripTransactions); diff --git a/src/pages/home/report/TripSummary.tsx b/src/pages/home/report/TripSummary.tsx index 750e760c1eb7..772a2878ec97 100644 --- a/src/pages/home/report/TripSummary.tsx +++ b/src/pages/home/report/TripSummary.tsx @@ -16,12 +16,16 @@ type TripSummaryProps = { function TripSummary({report}: TripSummaryProps) { const styles = useThemeStyles(); + if (!report?.reportID) { + return null; + } + return ( - + From e77991fe3d2d5ac758687652a7fa27ceee507626 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 14 Jan 2025 17:19:58 +0100 Subject: [PATCH 7/7] Fix lint --- .../report/ReportActionItemParentAction.tsx | 29 +++++++++---------- .../report/ReportActionsListItemRenderer.tsx | 17 +++++------ 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx index 6c904d0819fd..332f773a7b44 100644 --- a/src/pages/home/report/ReportActionItemParentAction.tsx +++ b/src/pages/home/report/ReportActionItemParentAction.tsx @@ -7,9 +7,10 @@ import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import onyxSubscribe from '@libs/onyxSubscribe'; -import * as ReportActionsUtils from '@libs/ReportActionsUtils'; -import * as ReportUtils from '@libs/ReportUtils'; -import * as Report from '@userActions/Report'; +import {shouldReportActionBeVisible} from '@libs/ReportActionsUtils'; +import type {Ancestor} from '@libs/ReportUtils'; +import {canCurrentUserOpenReport, canUserPerformWriteAction as canUserPerformWriteActionReportUtils, getAllAncestorReportActionIDs, getAllAncestorReportActions} from '@libs/ReportUtils'; +import {navigateToConciergeChatAndDeleteReport} from '@userActions/Report'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; @@ -64,9 +65,9 @@ function ReportActionItemParentAction({ }: ReportActionItemParentActionProps) { const styles = useThemeStyles(); const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); - const ancestorIDs = useRef(ReportUtils.getAllAncestorReportActionIDs(report)); + const ancestorIDs = useRef(getAllAncestorReportActionIDs(report)); const ancestorReports = useRef>>({}); - const [allAncestors, setAllAncestors] = useState([]); + const [allAncestors, setAllAncestors] = useState([]); const {isOffline} = useNetwork(); useEffect(() => { @@ -82,7 +83,7 @@ function ReportActionItemParentAction({ // holds the report collection. However, allReports is not updated by the time this current callback is called. // Therefore we need to pass the up-to-date report to getAllAncestorReportActions so that it uses the up-to-date report value // to calculate, for instance, unread marker. - setAllAncestors(ReportUtils.getAllAncestorReportActions(report, val)); + setAllAncestors(getAllAncestorReportActions(report, val)); }, }), ); @@ -90,7 +91,7 @@ function ReportActionItemParentAction({ onyxSubscribe({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReportID}`, callback: () => { - setAllAncestors(ReportUtils.getAllAncestorReportActions(report)); + setAllAncestors(getAllAncestorReportActions(report)); }, }), ); @@ -109,7 +110,7 @@ function ReportActionItemParentAction({ {/* eslint-disable-next-line react-compiler/react-compiler */} {allAncestors.map((ancestor) => { const ancestorReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${ancestor.report.reportID}`]; - const canUserPerformWriteAction = ReportUtils.canUserPerformWriteAction(ancestorReport); + const canUserPerformWriteAction = canUserPerformWriteActionReportUtils(ancestorReport); return ( Report.navigateToConciergeChatAndDeleteReport(ancestor.report.reportID)} + onClose={() => navigateToConciergeChatAndDeleteReport(ancestor.report.reportID)} > { - const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible( - ancestor.reportAction, - ancestor.reportAction.reportActionID, - canUserPerformWriteAction, - ); + const isVisibleAction = shouldReportActionBeVisible(ancestor.reportAction, ancestor.reportAction.reportActionID, canUserPerformWriteAction); // Pop the thread report screen before navigating to the chat report. Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID)); if (isVisibleAction && !isOffline) { diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index 696691ee23b8..7e2da550860c 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -1,7 +1,7 @@ import React, {memo, useMemo} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; -import * as ReportActionsUtils from '@libs/ReportActionsUtils'; -import * as ReportUtils from '@libs/ReportUtils'; +import {getOriginalMessage, isSentMoneyReportAction, isTransactionThread} from '@libs/ReportActionsUtils'; +import {getTripTransactions, isChatThread, isInvoiceRoom, isPolicyExpenseChat, isTripRoom} from '@libs/ReportUtils'; import CONST from '@src/CONST'; import type {Report, ReportAction} from '@src/types/onyx'; import ReportActionItem from './ReportActionItem'; @@ -72,7 +72,7 @@ function ReportActionsListItemRenderer({ shouldUseThreadDividerLine = false, parentReportActionForTransactionThread, }: ReportActionsListItemRendererProps) { - const originalMessage = useMemo(() => ReportActionsUtils.getOriginalMessage(reportAction), [reportAction]); + const originalMessage = useMemo(() => getOriginalMessage(reportAction), [reportAction]); /** * Create a lightweight ReportAction so as to keep the re-rendering as light as possible by @@ -143,17 +143,16 @@ function ReportActionsListItemRenderer({ ); const shouldDisplayParentAction = - reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && - (!ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isSentMoneyReportAction(parentReportAction)); + reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && (!isTransactionThread(parentReportAction) || isSentMoneyReportAction(parentReportAction)); - const tripTransactions = ReportUtils.getTripTransactions(report?.reportID); - const shouldDisplayTripSummary = shouldDisplayParentAction && ReportUtils.isTripRoom(report) && tripTransactions.length > 0; + const tripTransactions = getTripTransactions(report?.reportID); + const shouldDisplayTripSummary = shouldDisplayParentAction && isTripRoom(report) && tripTransactions.length > 0; if (shouldDisplayTripSummary) { return ; } - if (shouldDisplayParentAction && ReportUtils.isChatThread(report)) { + if (shouldDisplayParentAction && isChatThread(report)) { return (