Skip to content

Commit

Permalink
Merge pull request #46861 from bernhardoj/fix/46123-going-back-leads-…
Browse files Browse the repository at this point in the history
…to-same-main-chat-after-leaving-thread

Fix back button in the main chat reopens main chat after leaving thread
  • Loading branch information
jasperhuangg authored Aug 20, 2024
2 parents c7ec59b + ac4685b commit eb5964a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,14 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD

const leaveChat = useCallback(() => {
Navigation.dismissModal();
if (isRootGroupChat) {
Report.leaveGroupChat(report.reportID);
return;
}
const isWorkspaceMemberLeavingWorkspaceRoom = (report.visibility === CONST.REPORT.VISIBILITY.RESTRICTED || isPolicyExpenseChat) && isPolicyEmployee;
Report.leaveRoom(report.reportID, isWorkspaceMemberLeavingWorkspaceRoom);
Navigation.isNavigationReady().then(() => {
if (isRootGroupChat) {
Report.leaveGroupChat(report.reportID);
return;
}
const isWorkspaceMemberLeavingWorkspaceRoom = (report.visibility === CONST.REPORT.VISIBILITY.RESTRICTED || isPolicyExpenseChat) && isPolicyEmployee;
Report.leaveRoom(report.reportID, isWorkspaceMemberLeavingWorkspaceRoom);
});
}, [isPolicyEmployee, isPolicyExpenseChat, isRootGroupChat, report.reportID, report.visibility]);

const [moneyRequestReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID}`);
Expand Down

0 comments on commit eb5964a

Please sign in to comment.