Skip to content

Commit

Permalink
Merge pull request #44373 from bernhardoj/fix/44152-dismiss-modal-bef…
Browse files Browse the repository at this point in the history
…ore-leaving-group

Dismiss the details page before going back to most recent report
  • Loading branch information
Julesssss authored Jun 25, 2024
2 parents 7557e45 + be09825 commit d055598
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
}, [report?.reportID, isOffline, isPrivateNotesFetchTriggered, isSelfDM]);

const leaveChat = useCallback(() => {
Navigation.dismissModal();
if (isChatRoom) {
const isWorkspaceMemberLeavingWorkspaceRoom = (report.visibility === CONST.REPORT.VISIBILITY.RESTRICTED || isPolicyExpenseChat) && isPolicyEmployee;
Report.leaveRoom(report.reportID, isWorkspaceMemberLeavingWorkspaceRoom);
Expand Down Expand Up @@ -617,7 +618,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
isVisible={isLastMemberLeavingGroupModalVisible}
onConfirm={() => {
setIsLastMemberLeavingGroupModalVisible(false);
Report.leaveGroupChat(report.reportID);
leaveChat();
}}
onCancel={() => setIsLastMemberLeavingGroupModalVisible(false)}
prompt={translate('groupChat.lastMemberWarning')}
Expand Down

0 comments on commit d055598

Please sign in to comment.