From c2ab8935c13989de23d8ab8766945e65ce6fc2be Mon Sep 17 00:00:00 2001 From: robertpin Date: Thu, 25 Nov 2021 15:48:34 +0200 Subject: [PATCH] fix(breakout-rooms) Improve breakout rooms Don't show more menu on the main room Fix join room on mobile web When moving to room reset breakout rooms state to avoid showing incorrect data before response from prosody is received --- react/features/breakout-rooms/actionTypes.js | 15 ++++++++++----- react/features/breakout-rooms/actions.js | 6 +++++- .../components/web/RoomContextMenu.js | 2 +- .../breakout-rooms/components/web/RoomList.js | 3 ++- react/features/breakout-rooms/reducer.js | 4 ++++ 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/react/features/breakout-rooms/actionTypes.js b/react/features/breakout-rooms/actionTypes.js index 858e14aa8..e10938c05 100644 --- a/react/features/breakout-rooms/actionTypes.js +++ b/react/features/breakout-rooms/actionTypes.js @@ -1,12 +1,17 @@ // @flow +/** + * The type of (redux) action to reset the breakout rooms data. + */ +export const _RESET_BREAKOUT_ROOMS = '_RESET_BREAKOUT_ROOMS'; + +/** + * The type of (redux) action to update the room counter locally. + */ +export const _UPDATE_ROOM_COUNTER = '_UPDATE_ROOM_COUNTER'; + /** * The type of (redux) action to update the breakout room data. * */ export const UPDATE_BREAKOUT_ROOMS = 'UPDATE_BREAKOUT_ROOMS'; - -/** - * The type of (redux) action to update the room counter locally. - */ -export const _UPDATE_ROOM_COUNTER = '_UPDATE_ROOM_COUNTER'; diff --git a/react/features/breakout-rooms/actions.js b/react/features/breakout-rooms/actions.js index e12386b8d..f39725589 100644 --- a/react/features/breakout-rooms/actions.js +++ b/react/features/breakout-rooms/actions.js @@ -15,7 +15,7 @@ import { setAudioMuted, setVideoMuted } from '../base/media'; import { getRemoteParticipants } from '../base/participants'; import { clearNotifications } from '../notifications'; -import { _UPDATE_ROOM_COUNTER } from './actionTypes'; +import { _RESET_BREAKOUT_ROOMS, _UPDATE_ROOM_COUNTER } from './actionTypes'; import { FEATURE_KEY } from './constants'; import { getBreakoutRooms, @@ -175,6 +175,10 @@ export function moveToRoom(roomId?: string) { _roomId.domain = domainParts.join('@'); } + dispatch({ + type: _RESET_BREAKOUT_ROOMS + }); + if (navigator.product === 'ReactNative') { const conference = getCurrentConference(getState); const { audio, video } = getState()['features/base/media']; diff --git a/react/features/breakout-rooms/components/web/RoomContextMenu.js b/react/features/breakout-rooms/components/web/RoomContextMenu.js index 1230c5a50..fc7f091fc 100644 --- a/react/features/breakout-rooms/components/web/RoomContextMenu.js +++ b/react/features/breakout-rooms/components/web/RoomContextMenu.js @@ -56,7 +56,7 @@ export const RoomContextMenu = ({ const onJoinRoom = useCallback(() => { sendAnalytics(createBreakoutRoomsEvent('join')); - dispatch(moveToRoom(room.id)); + dispatch(moveToRoom(room.jid)); }, [ dispatch, room ]); const onRemoveBreakoutRoom = useCallback(() => { diff --git a/react/features/breakout-rooms/components/web/RoomList.js b/react/features/breakout-rooms/components/web/RoomList.js index 8ec0aa763..01b3ca883 100644 --- a/react/features/breakout-rooms/components/web/RoomList.js +++ b/react/features/breakout-rooms/components/web/RoomList.js @@ -47,7 +47,8 @@ export const RoomList = () => { room = { room }> {!_overflowDrawer && <> - {isLocalModerator && } + {isLocalModerator && !room.isMainRoom + && } } diff --git a/react/features/breakout-rooms/reducer.js b/react/features/breakout-rooms/reducer.js index 05202cfa0..abc2aeb20 100644 --- a/react/features/breakout-rooms/reducer.js +++ b/react/features/breakout-rooms/reducer.js @@ -3,6 +3,7 @@ import { ReducerRegistry } from '../base/redux'; import { + _RESET_BREAKOUT_ROOMS, _UPDATE_ROOM_COUNTER, UPDATE_BREAKOUT_ROOMS } from './actionTypes'; @@ -32,6 +33,9 @@ ReducerRegistry.register(FEATURE_KEY, (state = DEFAULT_STATE, action) => { rooms }; } + case _RESET_BREAKOUT_ROOMS: { + return DEFAULT_STATE; + } } return state;