diff --git a/react/features/whiteboard/functions.ts b/react/features/whiteboard/functions.ts index 38a8802d6..697e26c68 100644 --- a/react/features/whiteboard/functions.ts +++ b/react/features/whiteboard/functions.ts @@ -19,7 +19,7 @@ const getWhiteboardState = (state: IState): IWhiteboardState => state['features/ /** * Indicates whether the whiteboard is enabled in the config. * - * @param {Object} state - The state from the Redux store. + * @param {IState} state - The state from the Redux store. * @returns {boolean} */ export const isWhiteboardEnabled = (state: IState): boolean => @@ -31,7 +31,7 @@ export const isWhiteboardEnabled = (state: IState): boolean => /** * Indicates whether the whiteboard is open. * - * @param {Object} state - The state from the Redux store. + * @param {IState} state - The state from the Redux store. * @returns {boolean} */ export const isWhiteboardOpen = (state: IState): boolean => getWhiteboardState(state).isOpen; @@ -39,7 +39,7 @@ export const isWhiteboardOpen = (state: IState): boolean => getWhiteboardState(s /** * Indicates whether the whiteboard button is visible. * - * @param {Object} state - The state from the Redux store. + * @param {IState} state - The state from the Redux store. * @returns {boolean} */ export const isWhiteboardButtonVisible = (state: IState): boolean => @@ -48,16 +48,16 @@ export const isWhiteboardButtonVisible = (state: IState): boolean => /** * Indicates whether the whiteboard is present as a meeting participant. * - * @param {Object} state - The state from the Redux store. + * @param {IState} state - The state from the Redux store. * @returns {boolean} */ export const isWhiteboardPresent = (state: IState): boolean => getRemoteParticipants(state).has(WHITEBOARD_ID); /** - * Returns the whiteboard collaboration link. + * Returns the whiteboard collaboration details. * - * @param {Object} state - The state from the Redux store. - * @returns {{ roomId: string, roomKey: string}|null} + * @param {IState} state - The state from the Redux store. + * @returns {{ roomId: string, roomKey: string}|undefined} */ export const getCollabDetails = (state: IState): { roomId: string; roomKey: string; @@ -66,7 +66,7 @@ export const getCollabDetails = (state: IState): { /** * Returns the whiteboard collaboration server url. * - * @param {Object} state - The state from the Redux store. + * @param {IState} state - The state from the Redux store. * @returns {string} */ export const getCollabServerUrl = (state: IState): string | undefined => { @@ -87,7 +87,7 @@ export const getCollabServerUrl = (state: IState): string | undefined => { /** * Whether the whiteboard is visible on stage. * - * @param {Object} state - The state from the Redux store. + * @param {IState} state - The state from the Redux store. * @returns {boolean} */ export const isWhiteboardVisible = (state: IState): boolean => diff --git a/react/features/whiteboard/middleware.ts b/react/features/whiteboard/middleware.ts index 3b0a6f35a..abf0fd58b 100644 --- a/react/features/whiteboard/middleware.ts +++ b/react/features/whiteboard/middleware.ts @@ -21,7 +21,6 @@ import { addStageParticipant } from '../filmstrip/actions.web'; import { isStageFilmstripAvailable } from '../filmstrip/functions'; import { JitsiConferenceEvents } from '../base/lib-jitsi-meet'; import { FakeParticipant } from '../base/participants/types'; -import { getCurrentRoomId } from '../breakout-rooms/functions'; const focusWhiteboard = (store: IStore) => { const { dispatch, getState } = store; @@ -65,15 +64,10 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => async (action const collabServerUrl = getCollabServerUrl(state); focusWhiteboard(store); - dispatch(setupWhiteboard({ - collabDetails: { - roomId: getCurrentRoomId(state), - roomKey: collabDetails.roomKey - } - })); + dispatch(setupWhiteboard({ collabDetails })); conference.getMetadataHandler().setMetadata(WHITEBOARD_ID, { collabServerUrl, - roomKey: collabDetails.roomKey + collabDetails }); return; @@ -107,7 +101,7 @@ StateListenerRegistry.register( state => getCurrentConference(state), // @ts-ignore - (conference, { dispatch, getState }, previousConference): void => { + (conference, { dispatch }, previousConference): void => { if (conference !== previousConference) { dispatch(resetWhiteboard()); } @@ -115,10 +109,7 @@ StateListenerRegistry.register( conference.on(JitsiConferenceEvents.METADATA_UPDATED, (metadata: any) => { if (metadata[WHITEBOARD_ID]) { dispatch(setupWhiteboard({ - collabDetails: { - roomId: getCurrentRoomId(getState()), - roomKey: metadata[WHITEBOARD_ID].roomKey - } + collabDetails: metadata[WHITEBOARD_ID].collabDetails })); dispatch(setWhiteboardOpen(true)); }