Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(breakout-rooms) close room before removing it (#10956)
Mihaela Dumitru79877e56f0ed
diff --git a/react/features/breakout-rooms/actions.js b/react/features/breakout-rooms/actions.jsindex 53f3742f08..7a47aac30a 100644--- a/react/features/breakout-rooms/actions.js+++ b/react/features/breakout-rooms/actions.js@@ -33,7 +33,8 @@ import { _RESET_BREAKOUT_ROOMS, _UPDATE_ROOM_COUNTER } from './actionTypes';import { FEATURE_KEY } from './constants';import {getBreakoutRooms,- getMainRoom+ getMainRoom,+ getRoomByJid} from './functions';import logger from './logger';@@ -97,6 +98,17 @@ export function closeBreakoutRoom(roomId: string) {export function removeBreakoutRoom(breakoutRoomJid: string) {return (dispatch: Dispatch<any>, getState: Function) => {sendAnalytics(createBreakoutRoomsEvent('remove'));+ const room = getRoomByJid(getState, breakoutRoomJid);++ if (!room) {+ logger.error('The room to remove was not found.');++ return;+ }++ if (Object.keys(room.participants).length > 0) {+ dispatch(closeBreakoutRoom(room.id));+ }// $FlowExpectedErrorgetCurrentConference(getState)?.getBreakoutRooms()diff --git a/react/features/breakout-rooms/functions.js b/react/features/breakout-rooms/functions.jsindex 30e9430d97..92aed1eb42 100644--- a/react/features/breakout-rooms/functions.js+++ b/react/features/breakout-rooms/functions.js@@ -29,6 +29,20 @@ export const getMainRoom = (stateful: Function | Object) => {return _.find(rooms, (room: Object) => room.isMainRoom);};+/**+ * Returns the room by Jid.+ *+ * @param {Function|Object} stateful - The redux store, the redux+ * {@code getState} function, or the redux state itself.+ * @param {string} roomJid - The jid of the room.+ * @returns {Object|undefined} The main room object, or undefined.+ */+export const getRoomByJid = (stateful: Function | Object, roomJid: string): Object => {+ const rooms = getBreakoutRooms(stateful);++ return _.find(rooms, (room: Object) => room.jid === roomJid);+};+/*** Returns the id of the current room.*