diff --git a/src/DeepLinkHandler.tsx b/src/DeepLinkHandler.tsx index 3f23afdefabe..27513b0884c3 100644 --- a/src/DeepLinkHandler.tsx +++ b/src/DeepLinkHandler.tsx @@ -184,7 +184,7 @@ function DeepLinkHandler({onInitialUrl}: DeepLinkHandlerProps) { return; } hasRefetchedPublicRoom.current = true; - Report.openReport({reportID, introSelected, betas}); + Report.openReport({reportID, introSelected, betas, hasReportActions: false}); }, [isLoadingApp, allReports, introSelected, betas]); return null; diff --git a/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx b/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx index 7cb8592cade2..155d7bca62bc 100644 --- a/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx @@ -58,6 +58,7 @@ function WithReportOrNotFoundImpl = reportActions?.[`${props.route.params.reportActionID}`]; + const hasReportActions = !!reportActions; // Handle threads if needed if (!linkedReportAction?.reportActionID) { @@ -72,7 +73,7 @@ function WithReportOrNotFoundImpl) { const {route} = props; const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID}`); + const [hasReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${route.params.reportID}`, {selector: Boolean}); const [isLoadingApp = true] = useOnyx(ONYXKEYS.IS_LOADING_APP); const [reportDraft] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_DRAFT}${route.params.reportID}`); const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); @@ -104,7 +105,7 @@ function WithWritableReportOrNotFoundImpl { + return policyReports?.reduce( + (acc, curr) => { + acc[curr.reportID] = !!reportActions?.[curr.reportID]; + return acc; + }, + {} as Record, + ); + }, + }); // The newly created room reportID is stored in Onyx right before navigating back here so its row can play the highlight animation. // It is cleared by the create page once the navigation transition ends (see WorkspaceNewRoomPage), so the animation doesn't replay on a later visit. @@ -72,7 +83,7 @@ function WorkspaceRoomsPage({route}: WorkspaceRoomsPageProps) { // Admins open the details RHP directly instead of the room report, so the report is never fetched via ReportScreen. // Fetch it here so the RHP has full data (participants, metadata) for Join, Invite and renaming. // shouldMarkAsRead is false because the user only views the room details, not the conversation itself. - openReport({reportID: report.reportID, introSelected, betas, shouldMarkAsRead: false}); + openReport({reportID: report.reportID, introSelected, betas, shouldMarkAsRead: false, hasReportActions: !!hasReportActions?.[report.reportID]}); Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.getRoute(report.reportID))); return; }