diff --git a/src/components/AvatarWithDisplayName.tsx b/src/components/AvatarWithDisplayName.tsx
index 396c10151fbf..f6afb4dae2d6 100644
--- a/src/components/AvatarWithDisplayName.tsx
+++ b/src/components/AvatarWithDisplayName.tsx
@@ -141,6 +141,7 @@ function AvatarWithDisplayName({
)}
diff --git a/src/components/ParentNavigationSubtitle.tsx b/src/components/ParentNavigationSubtitle.tsx
index 3109453ca6b0..0ad32f18659b 100644
--- a/src/components/ParentNavigationSubtitle.tsx
+++ b/src/components/ParentNavigationSubtitle.tsx
@@ -1,8 +1,10 @@
import React from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import useLocalize from '@hooks/useLocalize';
+import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
+import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import CONST from '@src/CONST';
import type {ParentNavigationSummaryParams} from '@src/languages/types';
import ROUTES from '@src/ROUTES';
@@ -15,20 +17,25 @@ type ParentNavigationSubtitleProps = {
/** parent Report ID */
parentReportID?: string;
+ /** parent Report Action ID */
+ parentReportActionID?: string;
+
/** PressableWithoutFeedack additional styles */
pressableStyles?: StyleProp;
};
-function ParentNavigationSubtitle({parentNavigationSubtitleData, parentReportID = '', pressableStyles}: ParentNavigationSubtitleProps) {
+function ParentNavigationSubtitle({parentNavigationSubtitleData, parentReportActionID, parentReportID = '', pressableStyles}: ParentNavigationSubtitleProps) {
const styles = useThemeStyles();
const {workspaceName, reportName} = parentNavigationSubtitleData;
-
+ const {isOffline} = useNetwork();
const {translate} = useLocalize();
return (
{
- Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(parentReportID));
+ const parentAction = ReportActionsUtils.getReportAction(parentReportID, parentReportActionID ?? '');
+ const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible(parentAction, parentAction?.reportActionID ?? '');
+ Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(parentReportID, isVisibleAction && !isOffline ? parentReportActionID : undefined));
}}
accessibilityLabel={translate('threads.parentNavigationSummary', {reportName, workspaceName})}
role={CONST.ROLE.LINK}
diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index 9093bf32b9dd..ccfe329419e3 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -253,6 +253,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
)}
diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx
index 1b8957b833b0..1164666e4992 100644
--- a/src/pages/home/HeaderView.tsx
+++ b/src/pages/home/HeaderView.tsx
@@ -270,6 +270,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction,
)}
diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx
index 940cba181db7..902e38f4a181 100644
--- a/src/pages/home/ReportScreen.tsx
+++ b/src/pages/home/ReportScreen.tsx
@@ -586,7 +586,7 @@ function ReportScreen({
return false;
}
const action = sortedAllReportActions.find((item) => item.reportActionID === reportActionIDFromRoute);
- return action && ReportActionsUtils.isDeletedAction(action);
+ return action && !ReportActionsUtils.shouldReportActionBeVisible(action, action.reportActionID);
}, [reportActionIDFromRoute, sortedAllReportActions]);
if (isLinkedReportActionDeleted ?? (!shouldShowSkeleton && reportActionIDFromRoute && reportActions?.length === 0 && !isLinkingToMessage)) {
diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx
index 3d98973c86c4..537f6292c3e4 100644
--- a/src/pages/home/report/ReportActionItemParentAction.tsx
+++ b/src/pages/home/report/ReportActionItemParentAction.tsx
@@ -2,11 +2,13 @@ import React, {useEffect, useRef, useState} from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
+import useNetwork from '@hooks/useNetwork';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
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 ONYXKEYS from '@src/ONYXKEYS';
@@ -58,6 +60,7 @@ function ReportActionItemParentAction({
const {isSmallScreenWidth} = useWindowDimensions();
const ancestorIDs = useRef(ReportUtils.getAllAncestorReportActionIDs(report));
const [allAncestors, setAllAncestors] = useState([]);
+ const {isOffline} = useNetwork();
useEffect(() => {
const unsubscribeReports: Array<() => void> = [];
@@ -103,7 +106,12 @@ function ReportActionItemParentAction({
>
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? ''))}
+ onPress={() => {
+ const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible(ancestor.reportAction, ancestor.reportAction.reportActionID ?? '');
+ Navigation.navigate(
+ ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? '', isVisibleAction && !isOffline ? ancestor.reportAction.reportActionID : undefined),
+ );
+ }}
parentReportAction={parentReportAction}
report={ancestor.report}
reportActions={reportActions}
diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx
index d1b9c420b0af..85566b8c5fa0 100644
--- a/src/pages/home/report/ReportActionsList.tsx
+++ b/src/pages/home/report/ReportActionsList.tsx
@@ -464,10 +464,10 @@ function ReportActionsList({
setCurrentUnreadMarker(reportAction.reportActionID);
}
});
- if (!markerFound) {
+ if (!markerFound && !linkedReportActionID) {
setCurrentUnreadMarker(null);
}
- }, [sortedVisibleReportActions, report.reportID, shouldDisplayNewMarker, currentUnreadMarker]);
+ }, [sortedVisibleReportActions, report.reportID, shouldDisplayNewMarker, currentUnreadMarker, linkedReportActionID]);
useEffect(() => {
calculateUnreadMarker();
diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx
index e6ae2c155d65..e3dc873a3283 100755
--- a/src/pages/home/report/ReportActionsView.tsx
+++ b/src/pages/home/report/ReportActionsView.tsx
@@ -351,10 +351,7 @@ function ReportActionsView({
// and there are fewer than 23 items, indicating we've reached the oldest message.
const isLoadingOlderReportsFirstNeeded = checkIfContentSmallerThanList() && reportActions.length > 23;
- if (
- (reportActionID && indexOfLinkedAction > -1 && !hasNewestReportAction && !isLoadingOlderReportsFirstNeeded) ||
- (!reportActionID && !hasNewestReportAction && !isLoadingOlderReportsFirstNeeded)
- ) {
+ if ((reportActionID && indexOfLinkedAction > -1 && !isLoadingOlderReportsFirstNeeded) || (!reportActionID && !isLoadingOlderReportsFirstNeeded)) {
handleReportActionPagination({firstReportActionID: newestReportAction?.reportActionID});
}
}, [
@@ -363,7 +360,6 @@ function ReportActionsView({
checkIfContentSmallerThanList,
reportActionID,
indexOfLinkedAction,
- hasNewestReportAction,
handleReportActionPagination,
network.isOffline,
reportActions.length,
diff --git a/src/pages/home/report/ThreadDivider.tsx b/src/pages/home/report/ThreadDivider.tsx
index 083129e15e6d..c728cdf20db4 100644
--- a/src/pages/home/report/ThreadDivider.tsx
+++ b/src/pages/home/report/ThreadDivider.tsx
@@ -5,9 +5,11 @@ import * as Expensicons from '@components/Icon/Expensicons';
import {PressableWithoutFeedback} from '@components/Pressable';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
+import useNetwork from '@hooks/useNetwork';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
+import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import type {Ancestor} from '@libs/ReportUtils';
import variables from '@styles/variables';
import CONST from '@src/CONST';
@@ -22,11 +24,17 @@ function ThreadDivider({ancestor}: ThreadDividerProps) {
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();
+ const {isOffline} = useNetwork();
return (
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(ancestor?.report?.parentReportID ?? ''))}
+ onPress={() => {
+ const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible(ancestor.reportAction, ancestor.reportAction.reportActionID ?? '');
+ Navigation.navigate(
+ ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? '', isVisibleAction && !isOffline ? ancestor.reportAction.reportActionID : undefined),
+ );
+ }}
accessibilityLabel={translate('threads.thread')}
role={CONST.ROLE.BUTTON}
style={[styles.flexRow, styles.alignItemsCenter, styles.gap1]}