Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(whiteboard): allow non-moderators to close the whiteboard (#17424)

Mihaela Dumitrua695a6a62840
diff --git a/react/features/whiteboard/actions.web.ts b/react/features/whiteboard/actions.web.ts
index 4c31aa86f1..32b8582232 100644
--- a/react/features/whiteboard/actions.web.ts
+++ b/react/features/whiteboard/actions.web.ts
@@ -3,7 +3,7 @@ import { sendAnalytics } from '../analytics/functions';
import { IStore } from '../app/types';
import { resetWhiteboard, setWhiteboardOpen } from './actions.any';
-import { isWhiteboardAllowed, isWhiteboardOpen, isWhiteboardVisible } from './functions';
+import { getCollabDetails, isWhiteboardAllowed, isWhiteboardOpen, isWhiteboardVisible } from './functions';
import { WhiteboardStatus } from './types';
export * from './actions.any';
@@ -33,6 +33,12 @@ export function toggleWhiteboard(open?: boolean) {
} else if (!isOpen) {
dispatch(setWhiteboardOpen(true, true));
}
+ } else if (isOpen || getCollabDetails(state)) {
+ const shouldShow = open ?? !isOpen;
+
+ if (shouldShow !== isOpen) {
+ dispatch(setWhiteboardOpen(shouldShow));
+ }
} else if (typeof APP !== 'undefined') {
APP.API.notifyWhiteboardStatusChanged(WhiteboardStatus.FORBIDDEN);
}
diff --git a/react/features/whiteboard/functions.ts b/react/features/whiteboard/functions.ts
index 4462e68e08..00f3046d2a 100644
--- a/react/features/whiteboard/functions.ts
+++ b/react/features/whiteboard/functions.ts
@@ -63,7 +63,15 @@ export const isWhiteboardEnabled = (state: IReduxState): boolean =>
* @param {IReduxState} state - The state from the Redux store.
* @returns {boolean}
*/
-export const isWhiteboardOpen = (state: IReduxState): boolean => getWhiteboardState(state).isOpen;
+export const isWhiteboardOpen = (state: IReduxState): boolean => {
+ const { iAmRecorder, iAmSipGateway } = state['features/base/config'];
+
+ if (iAmRecorder || iAmSipGateway) {
+ return false;
+ }
+
+ return getWhiteboardState(state).isOpen;
+};
/**
* Indicates whether the whiteboard button is visible.
@@ -72,7 +80,8 @@ export const isWhiteboardOpen = (state: IReduxState): boolean => getWhiteboardSt
* @returns {boolean}
*/
export const isWhiteboardButtonVisible = (state: IReduxState): boolean =>
- isWhiteboardEnabled(state) && (isLocalParticipantModerator(state) || isWhiteboardOpen(state));
+ isWhiteboardEnabled(state)
+ && (isLocalParticipantModerator(state) || isWhiteboardOpen(state) || hasCollabDetails(state));
/**
* Indicates whether the whiteboard is present as a meeting participant.
@@ -168,6 +177,12 @@ export const shouldEnforceUserLimit = (state: IReduxState): boolean => {
* @returns {boolean}
*/
export const shouldNotifyUserLimit = (state: IReduxState): boolean => {
+ const { iAmRecorder, iAmSipGateway } = state['features/base/config'];
+
+ if (iAmRecorder || iAmSipGateway) {
+ return false;
+ }
+
const userLimit = getWhiteboardUserLimit(state);
if (userLimit === Infinity) {
diff --git a/react/features/whiteboard/middleware.web.ts b/react/features/whiteboard/middleware.web.ts
index baab11d9cd..4f4682dda4 100644
--- a/react/features/whiteboard/middleware.web.ts
+++ b/react/features/whiteboard/middleware.web.ts
@@ -75,10 +75,17 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: AnyA
const notifyUserLimit = shouldNotifyUserLimit(state);
const iAmRecorder = Boolean(state['features/base/config'].iAmRecorder);
+ const iAmSipGateway = Boolean(state['features/base/config'].iAmSipGateway);
+
+ if ((iAmRecorder || iAmSipGateway) && action.isOpen) {
+ logger.info('Whiteboard open skipped, not supported in recorder mode');
+
+ return next(action);
+ }
+
if (enforceUserLimit) {
dispatch(restrictWhiteboard(false));
dispatch(openDialog('WhiteboardLimitDialog', WhiteboardLimitDialog));
- iAmRecorder && setTimeout(() => dispatch(hideDialog('WhiteboardLimitDialog', WhiteboardLimitDialog)), 3000);
return next(action);
}