From 6302c1e9b787fd39d502891c5d516839e78870cd Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Mon, 15 Apr 2024 08:41:11 -1000 Subject: [PATCH] Merge pull request #40155 from rayane-djouah/Update-thread-headers-ancestry-to-deep-link-back-to-the-original-comment Follow up to "Update thread headers ancestry to deep link back to the original comment" (cherry picked from commit a2d1af97d874fe68171a825bd945d485ddd0eacf) --- .../report/ContextMenu/PopoverReportActionContextMenu.tsx | 5 +++++ src/pages/home/report/ReportActionItemParentAction.tsx | 2 +- src/pages/home/report/ThreadDivider.tsx | 4 +--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx index 6cb688ff2558..6c9ed8b0a008 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -9,9 +9,11 @@ import ConfirmModal from '@components/ConfirmModal'; import PopoverWithMeasuredContent from '@components/PopoverWithMeasuredContent'; import useLocalize from '@hooks/useLocalize'; import calculateAnchorPosition from '@libs/calculateAnchorPosition'; +import Navigation from '@libs/Navigation/Navigation'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as IOU from '@userActions/IOU'; import * as Report from '@userActions/Report'; +import ROUTES from '@src/ROUTES'; import type {AnchorDimensions} from '@src/styles'; import type {ReportAction} from '@src/types/onyx'; import BaseReportActionContextMenu from './BaseReportActionContextMenu'; @@ -272,6 +274,9 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef 0)) { + Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportIDRef.current)); + } } DeviceEventEmitter.emit(`deletedReportAction_${reportIDRef.current}`, reportAction?.reportActionID); diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx index 537f6292c3e4..6c225421e356 100644 --- a/src/pages/home/report/ReportActionItemParentAction.tsx +++ b/src/pages/home/report/ReportActionItemParentAction.tsx @@ -108,7 +108,7 @@ function ReportActionItemParentAction({ { const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible(ancestor.reportAction, ancestor.reportAction.reportActionID ?? ''); - Navigation.navigate( + Navigation.goBack( ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? '', isVisibleAction && !isOffline ? ancestor.reportAction.reportActionID : undefined), ); }} diff --git a/src/pages/home/report/ThreadDivider.tsx b/src/pages/home/report/ThreadDivider.tsx index c728cdf20db4..f8acf63832b7 100644 --- a/src/pages/home/report/ThreadDivider.tsx +++ b/src/pages/home/report/ThreadDivider.tsx @@ -31,9 +31,7 @@ function ThreadDivider({ancestor}: ThreadDividerProps) { { 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), - ); + Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? '', isVisibleAction && !isOffline ? ancestor.reportAction.reportActionID : undefined)); }} accessibilityLabel={translate('threads.thread')} role={CONST.ROLE.BUTTON}