Skip to content

Commit

Permalink
Merge pull request #40155 from rayane-djouah/Update-thread-headers-an…
Browse files Browse the repository at this point in the history
…cestry-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 a2d1af9)
  • Loading branch information
marcaaron authored and OSBotify committed Apr 15, 2024
1 parent 9004ea4 commit 6302c1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -272,6 +274,9 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
}
} else if (reportAction) {
Report.deleteReportComment(reportIDRef.current, reportAction);
if (!((reportAction?.childVisibleActionCount ?? 0) > 0)) {
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportIDRef.current));
}
}

DeviceEventEmitter.emit(`deletedReportAction_${reportIDRef.current}`, reportAction?.reportActionID);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemParentAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function ReportActionItemParentAction({
<ReportActionItem
onPress={() => {
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),
);
}}
Expand Down
4 changes: 1 addition & 3 deletions src/pages/home/report/ThreadDivider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ function ThreadDivider({ancestor}: ThreadDividerProps) {
<PressableWithoutFeedback
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),
);
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? '', isVisibleAction && !isOffline ? ancestor.reportAction.reportActionID : undefined));
}}
accessibilityLabel={translate('threads.thread')}
role={CONST.ROLE.BUTTON}
Expand Down

0 comments on commit 6302c1e

Please sign in to comment.