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(buttonsWithNotify): Duplicates in config

Hristo Terezov26e09acb8ab5
diff --git a/react/features/base/config/functions.web.ts b/react/features/base/config/functions.web.ts
index 9109deee3c..1a21fecbac 100644
--- a/react/features/base/config/functions.web.ts
+++ b/react/features/base/config/functions.web.ts
@@ -1,13 +1,11 @@
import { IReduxState } from '../../app/types';
import JitsiMeetJS from '../../base/lib-jitsi-meet';
-import { NOTIFY_CLICK_MODE } from '../../toolbox/constants';
import {
IConfig,
IDeeplinkingConfig,
IDeeplinkingDesktopConfig,
- IDeeplinkingMobileConfig,
- NotifyClickButton
+ IDeeplinkingMobileConfig
} from './configType';
export * from './functions.any';
@@ -99,93 +97,3 @@ export function _setDeeplinkingDefaults(deeplinking: IDeeplinkingConfig) {
android.dynamicLink.isi = android.dynamicLink.isi || '1165103905';
}
}
-
-/**
- * Common logic to gather buttons that have to notify the api when clicked.
- *
- * @param {Array} buttonsWithNotifyClick - The array of systme buttons that need to notify the api.
- * @param {Array} customButtons - The custom buttons.
- * @returns {Array}
- */
-const buildButtonsArray = (
- buttonsWithNotifyClick?: NotifyClickButton[],
- customButtons?: {
- icon: string;
- id: string;
- text: string;
- }[]
-): NotifyClickButton[] => {
- const customButtonsWithNotifyClick = customButtons?.map(({ id }) => {
- return {
- key: id,
- preventExecution: false
- };
- });
-
- const buttons = Array.isArray(buttonsWithNotifyClick)
- ? buttonsWithNotifyClick as NotifyClickButton[]
- : [];
-
- if (customButtonsWithNotifyClick) {
- buttons.push(...customButtonsWithNotifyClick);
- }
-
- return buttons;
-};
-
-/**
- * Returns the list of toolbar buttons that have to notify the api when clicked.
- *
- * @param {Object} state - The redux state.
- * @returns {Array} - The list of buttons.
- */
-export function getButtonsWithNotifyClick(
- state: IReduxState
-): NotifyClickButton[] {
- const { buttonsWithNotifyClick, customToolbarButtons } = state['features/base/config'];
-
- return buildButtonsArray(
- buttonsWithNotifyClick,
- customToolbarButtons
- );
-}
-
-/**
- * Returns the list of participant menu buttons that have that notify the api when clicked.
- *
- * @param {Object} state - The redux state.
- * @returns {Array} - The list of participant menu buttons.
- */
-export function getParticipantMenuButtonsWithNotifyClick(
- state: IReduxState
-): NotifyClickButton[] {
- const { participantMenuButtonsWithNotifyClick, customParticipantMenuButtons } = state['features/base/config'];
-
- return buildButtonsArray(
- participantMenuButtonsWithNotifyClick,
- customParticipantMenuButtons
- );
-}
-
-/**
- * Returns the notify mode for the specified button.
- *
- * @param {string} buttonKey - The button key.
- * @param {Array} buttonsWithNotifyClick - The buttons with notify click.
- * @returns {string|undefined}
- */
-export const getButtonNotifyMode = (
- buttonKey: string,
- buttonsWithNotifyClick?: NotifyClickButton[]
-): string | undefined => {
- const notify = buttonsWithNotifyClick?.find(
- (btn: NotifyClickButton) =>
- (typeof btn === 'string' && btn === buttonKey) || (typeof btn === 'object' && btn.key === buttonKey)
- );
-
- if (notify) {
- return typeof notify === 'string' || notify.preventExecution
- ? NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
- : NOTIFY_CLICK_MODE.ONLY_NOTIFY;
- }
-};
diff --git a/react/features/base/toolbox/components/AbstractButton.tsx b/react/features/base/toolbox/components/AbstractButton.tsx
index f5771a8366..eb43f236e3 100644
--- a/react/features/base/toolbox/components/AbstractButton.tsx
+++ b/react/features/base/toolbox/components/AbstractButton.tsx
@@ -3,7 +3,7 @@ import { WithTranslation } from 'react-i18next';
import { GestureResponderEvent } from 'react-native';
import { IStore } from '../../../app/types';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { combineStyles } from '../../styles/functions.any';
import { Styles } from './AbstractToolboxItem';
diff --git a/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx b/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx
index 915b8ecd52..8af000fb74 100644
--- a/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx
+++ b/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import { NOTIFY_CLICK_MODE } from '../../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../../toolbox/types';
import Icon from '../../../icons/components/Icon';
import Tooltip from '../../../tooltip/components/Tooltip';
diff --git a/react/features/participants-pane/components/breakout-rooms/components/web/RoomParticipantContextMenu.tsx b/react/features/participants-pane/components/breakout-rooms/components/web/RoomParticipantContextMenu.tsx
index ad2ef17661..f66a5e34a1 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/web/RoomParticipantContextMenu.tsx
+++ b/react/features/participants-pane/components/breakout-rooms/components/web/RoomParticipantContextMenu.tsx
@@ -4,21 +4,16 @@ import { useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import Avatar from '../../../../../base/avatar/components/Avatar';
-import {
- getButtonNotifyMode,
- getParticipantMenuButtonsWithNotifyClick
-} from '../../../../../base/config/functions.web';
import { isLocalParticipantModerator } from '../../../../../base/participants/functions';
import ContextMenu from '../../../../../base/ui/components/web/ContextMenu';
import ContextMenuItemGroup from '../../../../../base/ui/components/web/ContextMenuItemGroup';
import { getBreakoutRooms } from '../../../../../breakout-rooms/functions';
-import { NOTIFY_CLICK_MODE } from '../../../../../toolbox/constants';
-import { showOverflowDrawer } from '../../../../../toolbox/functions.web';
+import { getParticipantMenuButtonsWithNotifyClick, showOverflowDrawer } from '../../../../../toolbox/functions.web';
+import { NOTIFY_CLICK_MODE } from '../../../../../toolbox/types';
import SendToRoomButton from '../../../../../video-menu/components/web/SendToRoomButton';
import { PARTICIPANT_MENU_BUTTONS as BUTTONS } from '../../../../../video-menu/constants';
import { AVATAR_SIZE } from '../../../../constants';
-
interface IProps {
/**
@@ -82,7 +77,7 @@ export const RoomParticipantContextMenu = ({
const notifyClick = useCallback(
(buttonKey: string, participantId?: string) => {
- const notifyMode = getButtonNotifyMode(buttonKey, buttonsWithNotifyClick);
+ const notifyMode = buttonsWithNotifyClick?.get(buttonKey);
if (!notifyMode) {
return;
@@ -93,7 +88,7 @@ export const RoomParticipantContextMenu = ({
participantId,
notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
);
- }, [ buttonsWithNotifyClick, getButtonNotifyMode ]);
+ }, [ buttonsWithNotifyClick ]);
const breakoutRoomsButtons = useMemo(() => Object.values(rooms || {}).map((room: any) => {
if (room.id !== entity?.room?.id) {
@@ -101,7 +96,7 @@ export const RoomParticipantContextMenu = ({
key = { room.id }
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.SEND_PARTICIPANT_TO_ROOM, entity?.jid) }
- notifyMode = { getButtonNotifyMode(BUTTONS.SEND_PARTICIPANT_TO_ROOM, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.SEND_PARTICIPANT_TO_ROOM) }
onClick = { lowerMenu }
participantID = { entity?.jid ?? '' }
room = { room } />);
@@ -109,7 +104,7 @@ export const RoomParticipantContextMenu = ({
return null;
})
- .filter(Boolean), [ entity, rooms ]);
+ .filter(Boolean), [ entity, rooms, buttonsWithNotifyClick ]);
return isLocalModerator ? (
<ContextMenu
diff --git a/react/features/participants-pane/components/web/InviteButton.tsx b/react/features/participants-pane/components/web/InviteButton.tsx
index 438cb5cd49..1dca3510c4 100644
--- a/react/features/participants-pane/components/web/InviteButton.tsx
+++ b/react/features/participants-pane/components/web/InviteButton.tsx
@@ -5,22 +5,19 @@ import { useDispatch, useSelector } from 'react-redux';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState } from '../../../app/types';
-import { getButtonNotifyMode, getButtonsWithNotifyClick } from '../../../base/config/functions.web';
import { IconAddUser } from '../../../base/icons/svg';
import Button from '../../../base/ui/components/web/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.web';
import { beginAddPeople } from '../../../invite/actions';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
const INVITE_BUTTON_KEY = 'invite';
export const InviteButton = () => {
const dispatch = useDispatch();
const { t } = useTranslation();
- const notifyMode = useSelector((state: IReduxState) => getButtonNotifyMode(
- INVITE_BUTTON_KEY,
- getButtonsWithNotifyClick(state)
- ));
+ const notifyMode = useSelector(
+ (state: IReduxState) => state['features/toolbox'].buttonsWithNotifyClick?.get(INVITE_BUTTON_KEY));
const onInvite = useCallback(() => {
if (notifyMode) {
diff --git a/react/features/security/components/security-dialog/web/PasswordSection.tsx b/react/features/security/components/security-dialog/web/PasswordSection.tsx
index b499002545..99d19eae04 100644
--- a/react/features/security/components/security-dialog/web/PasswordSection.tsx
+++ b/react/features/security/components/security-dialog/web/PasswordSection.tsx
@@ -1,25 +1,21 @@
/* eslint-disable react/jsx-no-bind */
-import React, { useRef, useState } from 'react';
+import React, { useCallback, useRef, useState } from 'react';
import { WithTranslation } from 'react-i18next';
+import { useSelector } from 'react-redux';
+import { IReduxState } from '../../../../app/types';
import { translate } from '../../../../base/i18n/functions';
import { copyText } from '../../../../base/util/copyText.web';
import { LOCKED_LOCALLY } from '../../../../room-lock/constants';
-import { NOTIFY_CLICK_MODE } from '../../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../../toolbox/types';
import PasswordForm from './PasswordForm';
-import { INotifyClick } from './SecurityDialog';
const DIGITS_ONLY = /^\d+$/;
const KEY = 'add-passcode';
interface IProps extends WithTranslation {
- /**
- * Toolbar buttons which have their click exposed through the API.
- */
- buttonsWithNotifyClick: Array<string | INotifyClick>;
-
/**
* Whether or not the current user can modify the current password.
*/
@@ -69,7 +65,6 @@ interface IProps extends WithTranslation {
* @returns {React$Element<any>}
*/
function PasswordSection({
- buttonsWithNotifyClick,
canEditPassword,
conference,
locked,
@@ -82,6 +77,8 @@ function PasswordSection({
const formRef = useRef<HTMLDivElement>(null);
const [ passwordVisible, setPasswordVisible ] = useState(false);
+ const buttonsWithNotifyClick = useSelector(
+ (state: IReduxState) => state['features/toolbox'].buttonsWithNotifyClick);
/**
* Callback invoked to set a password on the current JitsiConference.
@@ -106,24 +103,16 @@ function PasswordSection({
* @private
* @returns {void}
*/
- function onTogglePasswordEditState() {
- if (typeof APP === 'undefined' || !buttonsWithNotifyClick?.length) {
+ const onTogglePasswordEditState = useCallback(() => {
+ if (typeof APP === 'undefined' || !buttonsWithNotifyClick?.size) {
setPasswordEditEnabled(!passwordEditEnabled);
return;
}
- let notifyMode;
- const notify = buttonsWithNotifyClick.find(
- (btn: string | INotifyClick) =>
- (typeof btn === 'string' && btn === KEY)
- || (typeof btn === 'object' && btn.key === KEY)
- );
+ const notifyMode = buttonsWithNotifyClick?.get(KEY);
- if (notify) {
- notifyMode = typeof notify === 'string' || notify.preventExecution
- ? NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
- : NOTIFY_CLICK_MODE.ONLY_NOTIFY;
+ if (notifyMode) {
APP.API.notifyToolbarButtonClicked(
KEY, notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
);
@@ -132,7 +121,7 @@ function PasswordSection({
if (notifyMode === NOTIFY_CLICK_MODE.ONLY_NOTIFY) {
setPasswordEditEnabled(!passwordEditEnabled);
}
- }
+ }, [ buttonsWithNotifyClick, setPasswordEditEnabled, passwordEditEnabled ]);
/**
* Method to remotely submit the password from outside of the password form.
diff --git a/react/features/security/components/security-dialog/web/SecurityDialog.tsx b/react/features/security/components/security-dialog/web/SecurityDialog.tsx
index 23485e8262..6c4af4e193 100644
--- a/react/features/security/components/security-dialog/web/SecurityDialog.tsx
+++ b/react/features/security/components/security-dialog/web/SecurityDialog.tsx
@@ -20,11 +20,6 @@ export interface INotifyClick {
interface IProps {
- /**
- * Toolbar buttons which have their click exposed through the API.
- */
- _buttonsWithNotifyClick: Array<string | INotifyClick>;
-
/**
* Whether or not the current user can modify the current password.
*/
@@ -79,7 +74,6 @@ interface IProps {
* @returns {React$Element<any>}
*/
function SecurityDialog({
- _buttonsWithNotifyClick,
_canEditPassword,
_conference,
_disableLobbyPassword,
@@ -112,7 +106,6 @@ function SecurityDialog({
<>
{ _isEnablingLobbyAllowed && <div className = 'separator-line' /> }
<PasswordSection
- buttonsWithNotifyClick = { _buttonsWithNotifyClick }
canEditPassword = { _canEditPassword }
conference = { _conference }
locked = { _locked }
@@ -151,17 +144,13 @@ function mapStateToProps(state: IReduxState) {
locked,
password
} = state['features/base/conference'];
- const {
- roomPasswordNumberOfDigits,
- buttonsWithNotifyClick
- } = state['features/base/config'];
+ const { roomPasswordNumberOfDigits } = state['features/base/config'];
const { disableLobbyPassword } = getSecurityUiConfig(state);
const _isEnablingLobbyAllowed = isEnablingLobbyAllowed(state);
const showE2ee = Boolean(e2eeSupported) && isLocalParticipantModerator(state);
return {
- _buttonsWithNotifyClick: buttonsWithNotifyClick ?? [],
_canEditPassword: isLocalParticipantModerator(state),
_conference: conference,
_dialIn: state['features/invite'],
diff --git a/react/features/toolbox/actionTypes.ts b/react/features/toolbox/actionTypes.ts
index 56d3f11751..ed7ba15b93 100644
--- a/react/features/toolbox/actionTypes.ts
+++ b/react/features/toolbox/actionTypes.ts
@@ -18,6 +18,26 @@ export const CLEAR_TOOLBOX_TIMEOUT = 'CLEAR_TOOLBOX_TIMEOUT';
*/
export const FULL_SCREEN_CHANGED = 'FULL_SCREEN_CHANGED';
+/**
+ * The type of (redux) action which sets the buttonsWithNotifyClick redux property.
+ *
+ * {
+ * type: SET_BUTTONS_WITH_NOTIFY_CLICK,
+ * buttonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>
+ * }
+ */
+export const SET_BUTTONS_WITH_NOTIFY_CLICK = 'SET_BUTTONS_WITH_NOTIFY_CLICK';
+
+/**
+ * The type of (redux) action which sets the participantMenuButtonsWithNotifyClick redux property.
+ *
+ * {
+ * type: SET_BUTTONS_WITH_NOTIFY_CLICK,
+ * participantMenuButtonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>
+ * }
+ */
+export const SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK = 'SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK';
+
/**
* The type of (redux) action which requests full screen mode be entered or
* exited.
diff --git a/react/features/toolbox/components/web/HangupContextMenuItem.tsx b/react/features/toolbox/components/web/HangupContextMenuItem.tsx
index 859d78fa87..2237ffedb9 100644
--- a/react/features/toolbox/components/web/HangupContextMenuItem.tsx
+++ b/react/features/toolbox/components/web/HangupContextMenuItem.tsx
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import Button from '../../../base/ui/components/web/Button';
-import { NOTIFY_CLICK_MODE } from '../../constants';
+import { NOTIFY_CLICK_MODE } from '../../types';
/**
diff --git a/react/features/toolbox/components/web/Toolbox.tsx b/react/features/toolbox/components/web/Toolbox.tsx
index 26805ed72f..82343a8a7b 100644
--- a/react/features/toolbox/components/web/Toolbox.tsx
+++ b/react/features/toolbox/components/web/Toolbox.tsx
@@ -4,8 +4,6 @@ import { connect } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import { IReduxState, IStore } from '../../../app/types';
-import { NotifyClickButton } from '../../../base/config/configType';
-import { getButtonNotifyMode, getButtonsWithNotifyClick } from '../../../base/config/functions.web';
import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
import { isLocalParticipantModerator } from '../../../base/participants/functions';
@@ -25,7 +23,7 @@ import {
isToolboxVisible
} from '../../functions.web';
import { useKeyboardShortcuts } from '../../hooks.web';
-import { IToolboxButton } from '../../types';
+import { IToolboxButton, NOTIFY_CLICK_MODE } from '../../types';
import HangupButton from '../HangupButton';
import { EndConferenceButton } from './EndConferenceButton';
@@ -42,7 +40,7 @@ interface IProps extends WithTranslation {
/**
* Toolbar buttons which have their click exposed through the API.
*/
- _buttonsWithNotifyClick?: NotifyClickButton[];
+ _buttonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>;
/**
* Whether or not the chat feature is currently displayed.
@@ -262,13 +260,13 @@ const Toolbox = ({
* @returns {void}
*/
function setButtonsNotifyClickMode(buttons: Object) {
- if (typeof APP === 'undefined' || !_buttonsWithNotifyClick?.length) {
+ if (typeof APP === 'undefined' || (_buttonsWithNotifyClick?.size ?? 0) <= 0) {
return;
}
Object.values(buttons).forEach((button: any) => {
if (typeof button === 'object') {
- button.notifyMode = getButtonNotifyMode(button.key, _buttonsWithNotifyClick);
+ button.notifyMode = _buttonsWithNotifyClick.get(button.key);
}
});
}
@@ -423,7 +421,7 @@ const Toolbox = ({
ariaControls = 'hangup-menu'
isOpen = { _hangupMenuVisible }
key = 'hangup-menu'
- notifyMode = { getButtonNotifyMode('hangup-menu', _buttonsWithNotifyClick) }
+ notifyMode = { _buttonsWithNotifyClick?.get('hangup-menu') }
onVisibilityChange = { onSetHangupVisible }>
<ContextMenu
accessibilityLabel = { t(toolbarAccLabel) }
@@ -433,20 +431,17 @@ const Toolbox = ({
onKeyDown = { onEscKey }>
<EndConferenceButton
buttonKey = 'end-meeting'
- notifyMode = { getButtonNotifyMode(
- 'end-meeting',
- _buttonsWithNotifyClick
- ) } />
+ notifyMode = { _buttonsWithNotifyClick?.get('end-meeting') } />
<LeaveConferenceButton
buttonKey = 'hangup'
- notifyMode = { getButtonNotifyMode('hangup', _buttonsWithNotifyClick) } />
+ notifyMode = { _buttonsWithNotifyClick?.get('hangup') } />
</ContextMenu>
</HangupMenuButton>
: <HangupButton
buttonKey = 'hangup'
customClass = 'hangup-button'
key = 'hangup-button'
- notifyMode = { getButtonNotifyMode('hangup', _buttonsWithNotifyClick) }
+ notifyMode = { _buttonsWithNotifyClick.get('hangup') }
visible = { isButtonEnabled('hangup', _toolbarButtons) } />
)}
</div>
@@ -499,7 +494,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
const toolbarButtons = ownProps.toolbarButtons || state['features/toolbox'].toolbarButtons;
return {
- _buttonsWithNotifyClick: getButtonsWithNotifyClick(state),
+ _buttonsWithNotifyClick: state['features/toolbox'].buttonsWithNotifyClick,
_chatOpen: state['features/chat'].isOpen,
_clientWidth: clientWidth,
_customToolbarButtons: customToolbarButtons,
diff --git a/react/features/toolbox/constants.ts b/react/features/toolbox/constants.ts
index c0cee6d75e..d50bd1d2e3 100644
--- a/react/features/toolbox/constants.ts
+++ b/react/features/toolbox/constants.ts
@@ -40,11 +40,6 @@ export const TOOLBAR_TIMEOUT = 4000;
export const DRAWER_MAX_HEIGHT = '80dvh - 64px';
-export const NOTIFY_CLICK_MODE = {
- ONLY_NOTIFY: 'ONLY_NOTIFY',
- PREVENT_AND_NOTIFY: 'PREVENT_AND_NOTIFY'
-};
-
// Around 300 to be displayed above components like chat
export const ZINDEX_DIALOG_PORTAL = 302;
diff --git a/react/features/toolbox/functions.web.ts b/react/features/toolbox/functions.web.ts
index 77d6964e4c..acbcfbd212 100644
--- a/react/features/toolbox/functions.web.ts
+++ b/react/features/toolbox/functions.web.ts
@@ -39,7 +39,7 @@ import ShareDesktopButton from './components/web/ShareDesktopButton';
import ToggleCameraButton from './components/web/ToggleCameraButton';
import VideoSettingsButton from './components/web/VideoSettingsButton';
import { TOOLBAR_TIMEOUT } from './constants';
-import { IToolboxButton } from './types';
+import { IToolboxButton, NOTIFY_CLICK_MODE } from './types';
export * from './functions.any';
@@ -442,3 +442,13 @@ export function getAllToolboxButtons(_customToolbarButtons?: {
...customButtons
};
}
+
+/**
+ * Returns the list of participant menu buttons that have that notify the api when clicked.
+ *
+ * @param {Object} state - The redux state.
+ * @returns {Map<string, NOTIFY_CLICK_MODE>} - The list of participant menu buttons.
+ */
+export function getParticipantMenuButtonsWithNotifyClick(state: IReduxState): Map<string, NOTIFY_CLICK_MODE> {
+ return state['features/toolbox'].participantMenuButtonsWithNotifyClick;
+}
diff --git a/react/features/toolbox/middleware.web.ts b/react/features/toolbox/middleware.web.ts
index a7fdf68b5b..1f2d94bfab 100644
--- a/react/features/toolbox/middleware.web.ts
+++ b/react/features/toolbox/middleware.web.ts
@@ -1,18 +1,23 @@
+import { batch } from 'react-redux';
import { AnyAction } from 'redux';
import { IReduxState } from '../app/types';
import { OVERWRITE_CONFIG, SET_CONFIG, UPDATE_CONFIG } from '../base/config/actionTypes';
+import { NotifyClickButton } from '../base/config/configType';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { I_AM_VISITOR_MODE } from '../visitors/actionTypes';
import { iAmVisitor } from '../visitors/functions';
import {
CLEAR_TOOLBOX_TIMEOUT,
+ SET_BUTTONS_WITH_NOTIFY_CLICK,
SET_FULL_SCREEN,
+ SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK,
SET_TOOLBAR_BUTTONS,
SET_TOOLBOX_TIMEOUT
} from './actionTypes';
import { TOOLBAR_BUTTONS, VISITORS_MODE_BUTTONS } from './constants';
+import { NOTIFY_CLICK_MODE } from './types';
import './subscriber.web';
@@ -36,9 +41,33 @@ MiddlewareRegistry.register(store => next => action => {
case I_AM_VISITOR_MODE:
case SET_CONFIG: {
const result = next(action);
- const toolbarButtons = _getToolbarButtons(store.getState());
+ const { dispatch, getState } = store;
+ const state = getState();
+
+ if (action.type !== I_AM_VISITOR_MODE) {
+ const {
+ customToolbarButtons,
+ buttonsWithNotifyClick,
+ participantMenuButtonsWithNotifyClick,
+ customParticipantMenuButtons
+ } = state['features/base/config'];
+
+ batch(() => {
+ dispatch({
+ type: SET_BUTTONS_WITH_NOTIFY_CLICK,
+ buttonsWithNotifyClick: _buildButtonsArray(buttonsWithNotifyClick, customToolbarButtons)
+ });
+ dispatch({
+ type: SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK,
+ participantMenuButtonsWithNotifyClick:
+ _buildButtonsArray(participantMenuButtonsWithNotifyClick, customParticipantMenuButtons)
+ });
+ });
+ }
+
+ const toolbarButtons = _getToolbarButtons(state);
- store.dispatch({
+ dispatch({
type: SET_TOOLBAR_BUTTONS,
toolbarButtons
});
@@ -106,6 +135,39 @@ function _setFullScreen(next: Function, action: AnyAction) {
return result;
}
+/**
+ * Common logic to gather buttons that have to notify the api when clicked.
+ *
+ * @param {Array} buttonsWithNotifyClick - The array of systme buttons that need to notify the api.
+ * @param {Array} customButtons - The custom buttons.
+ * @returns {Array}
+ */
+function _buildButtonsArray(
+ buttonsWithNotifyClick?: NotifyClickButton[],
+ customButtons?: {
+ icon: string;
+ id: string;
+ text: string;
+ }[]
+): Map<string, NOTIFY_CLICK_MODE> {
+ const customButtonsWithNotifyClick = customButtons?.map(
+ ({ id }) => ([ id, NOTIFY_CLICK_MODE.ONLY_NOTIFY ]) as [string, NOTIFY_CLICK_MODE]) ?? [];
+ const buttons = (Array.isArray(buttonsWithNotifyClick) ? buttonsWithNotifyClick : [])
+ .filter(button => typeof button === 'string' || (typeof button === 'object' && typeof button.key === 'string'))
+ .map(button => {
+ if (typeof button === 'string') {
+ return [ button, NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY ] as [string, NOTIFY_CLICK_MODE];
+ }
+
+ return [
+ button.key,
+ button.preventExecution ? NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY : NOTIFY_CLICK_MODE.ONLY_NOTIFY
+ ] as [string, NOTIFY_CLICK_MODE];
+ });
+
+ return new Map([ ...customButtonsWithNotifyClick, ...buttons ]);
+}
+
/**
* Returns the list of enabled toolbar buttons.
*
diff --git a/react/features/toolbox/reducer.ts b/react/features/toolbox/reducer.ts
index 705a805e09..eac258d283 100644
--- a/react/features/toolbox/reducer.ts
+++ b/react/features/toolbox/reducer.ts
@@ -4,9 +4,11 @@ import { set } from '../base/redux/functions';
import {
CLEAR_TOOLBOX_TIMEOUT,
FULL_SCREEN_CHANGED,
+ SET_BUTTONS_WITH_NOTIFY_CLICK,
SET_HANGUP_MENU_VISIBLE,
SET_OVERFLOW_DRAWER,
SET_OVERFLOW_MENU_VISIBLE,
+ SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK,
SET_TOOLBAR_BUTTONS,
SET_TOOLBAR_HOVERED,
SET_TOOLBOX_ENABLED,
@@ -15,11 +17,13 @@ import {
SET_TOOLBOX_VISIBLE,
TOGGLE_TOOLBOX_VISIBLE
} from './actionTypes';
+import { NOTIFY_CLICK_MODE } from './types';
/**
* Initial state of toolbox's part of Redux store.
*/
const INITIAL_STATE = {
+ buttonsWithNotifyClick: new Map(),
/**
* The indicator which determines whether the Toolbox is enabled.
@@ -43,6 +47,8 @@ const INITIAL_STATE = {
*/
hovered: false,
+ participantMenuButtonsWithNotifyClick: new Map(),
+
/**
* The indicator which determines whether the overflow menu(s) are to be displayed as drawers.
*
@@ -87,12 +93,14 @@ const INITIAL_STATE = {
};
export interface IToolboxState {
+ buttonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>;
enabled: boolean;
fullScreen?: boolean;
hangupMenuVisible: boolean;
hovered: boolean;
overflowDrawer: boolean;
overflowMenuVisible: boolean;
+ participantMenuButtonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>;
shiftUp: boolean;
timeoutID?: number | null;
toolbarButtons: Array<string>;
@@ -138,7 +146,11 @@ ReducerRegistry.register<IToolboxState>(
...state,
toolbarButtons: action.toolbarButtons
};
-
+ case SET_BUTTONS_WITH_NOTIFY_CLICK:
+ return {
+ ...state,
+ buttonsWithNotifyClick: action.buttonsWithNotifyClick
+ };
case SET_TOOLBAR_HOVERED:
return {
...state,
@@ -166,6 +178,12 @@ ReducerRegistry.register<IToolboxState>(
case SET_TOOLBOX_VISIBLE:
return set(state, 'visible', action.visible);
+ case SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK:
+ return {
+ ...state,
+ participantMenuButtonsWithNotifyClick: action.participantMenuButtonsWithNotifyClick
+ };
+
case TOGGLE_TOOLBOX_VISIBLE:
return set(state, 'visible', !state.visible);
}
diff --git a/react/features/toolbox/types.ts b/react/features/toolbox/types.ts
index 80712f1e31..9be8155ba3 100644
--- a/react/features/toolbox/types.ts
+++ b/react/features/toolbox/types.ts
@@ -44,3 +44,8 @@ export type ToolbarButton = 'camera' |
'videoquality' |
'whiteboard' |
'__end';
+
+export enum NOTIFY_CLICK_MODE {
+ ONLY_NOTIFY = 'ONLY_NOTIFY',
+ PREVENT_AND_NOTIFY = 'PREVENT_AND_NOTIFY'
+}
diff --git a/react/features/video-menu/components/web/AskToUnmuteButton.tsx b/react/features/video-menu/components/web/AskToUnmuteButton.tsx
index 1c73ab806f..f0bf8da4ba 100644
--- a/react/features/video-menu/components/web/AskToUnmuteButton.tsx
+++ b/react/features/video-menu/components/web/AskToUnmuteButton.tsx
@@ -6,7 +6,7 @@ import { approveParticipantAudio, approveParticipantVideo } from '../../../av-mo
import { IconMic, IconVideo } from '../../../base/icons/svg';
import { MEDIA_TYPE, MediaType } from '../../../base/media/constants';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
interface IProps extends IButtonProps {
diff --git a/react/features/video-menu/components/web/ConnectionStatusButton.tsx b/react/features/video-menu/components/web/ConnectionStatusButton.tsx
index ae2a8e1508..ab46a11e97 100644
--- a/react/features/video-menu/components/web/ConnectionStatusButton.tsx
+++ b/react/features/video-menu/components/web/ConnectionStatusButton.tsx
@@ -4,7 +4,7 @@ import { useDispatch } from 'react-redux';
import { IconInfoCircle } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { renderConnectionStatus } from '../../actions.web';
import { IButtonProps } from '../../types';
diff --git a/react/features/video-menu/components/web/DemoteToVisitorButton.tsx b/react/features/video-menu/components/web/DemoteToVisitorButton.tsx
index a0166c9df5..2bc7024776 100644
--- a/react/features/video-menu/components/web/DemoteToVisitorButton.tsx
+++ b/react/features/video-menu/components/web/DemoteToVisitorButton.tsx
@@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux';
import { openDialog } from '../../../base/dialog/actions';
import { IconUsers } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
import DemoteToVisitorDialog from './DemoteToVisitorDialog';
diff --git a/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx b/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx
index c61d42981c..c5b1f2a403 100644
--- a/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx
+++ b/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx
@@ -4,15 +4,14 @@ import { useDispatch, useSelector } from 'react-redux';
import TogglePinToStageButton from '../../../../features/video-menu/components/web/TogglePinToStageButton';
import Avatar from '../../../base/avatar/components/Avatar';
-import { getButtonNotifyMode, getParticipantMenuButtonsWithNotifyClick } from '../../../base/config/functions.web';
import { IconPlay } from '../../../base/icons/svg';
import { isWhiteboardParticipant } from '../../../base/participants/functions';
import { IParticipant } from '../../../base/participants/types';
import ContextMenu from '../../../base/ui/components/web/ContextMenu';
import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuItemGroup';
import { stopSharedVideo } from '../../../shared-video/actions.any';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
-import { showOverflowDrawer } from '../../../toolbox/functions.web';
+import { getParticipantMenuButtonsWithNotifyClick, showOverflowDrawer } from '../../../toolbox/functions.web';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { setWhiteboardOpen } from '../../../whiteboard/actions';
import { WHITEBOARD_ID } from '../../../whiteboard/constants';
import { PARTICIPANT_MENU_BUTTONS as BUTTONS } from '../../constants';
@@ -93,7 +92,7 @@ const FakeParticipantContextMenu = ({
const notifyClick = useCallback(
(buttonKey: string, participantId?: string) => {
- const notifyMode = getButtonNotifyMode(buttonKey, buttonsWithNotifyClick);
+ const notifyMode = buttonsWithNotifyClick?.get(buttonKey);
if (!notifyMode) {
return;
@@ -104,7 +103,7 @@ const FakeParticipantContextMenu = ({
participantId,
notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
);
- }, [ buttonsWithNotifyClick, getButtonNotifyMode ]);
+ }, [ buttonsWithNotifyClick ]);
const clickHandler = useCallback(() => onSelect(true), [ onSelect ]);
@@ -167,7 +166,7 @@ const FakeParticipantContextMenu = ({
key = 'pinToStage'
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.PIN_TO_STAGE, WHITEBOARD_ID) }
- notifyMode = { getButtonNotifyMode(BUTTONS.PIN_TO_STAGE, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.PIN_TO_STAGE) }
participantID = { WHITEBOARD_ID } />
)}
</ContextMenuItemGroup>
diff --git a/react/features/video-menu/components/web/FlipLocalVideoButton.tsx b/react/features/video-menu/components/web/FlipLocalVideoButton.tsx
index 63690355cf..2d77952c99 100644
--- a/react/features/video-menu/components/web/FlipLocalVideoButton.tsx
+++ b/react/features/video-menu/components/web/FlipLocalVideoButton.tsx
@@ -6,7 +6,7 @@ import { IReduxState, IStore } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { updateSettings } from '../../../base/settings/actions';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
/**
* The type of the React {@code Component} props of {@link FlipLocalVideoButton}.
diff --git a/react/features/video-menu/components/web/GrantModeratorButton.tsx b/react/features/video-menu/components/web/GrantModeratorButton.tsx
index 583f75e8da..020bc85f4f 100644
--- a/react/features/video-menu/components/web/GrantModeratorButton.tsx
+++ b/react/features/video-menu/components/web/GrantModeratorButton.tsx
@@ -8,7 +8,7 @@ import { IconModerator } from '../../../base/icons/svg';
import { PARTICIPANT_ROLE } from '../../../base/participants/constants';
import { getLocalParticipant, getParticipantById, isParticipantModerator } from '../../../base/participants/functions';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
import GrantModeratorDialog from './GrantModeratorDialog';
diff --git a/react/features/video-menu/components/web/HideSelfViewVideoButton.tsx b/react/features/video-menu/components/web/HideSelfViewVideoButton.tsx
index ac10a14371..146505a8ba 100644
--- a/react/features/video-menu/components/web/HideSelfViewVideoButton.tsx
+++ b/react/features/video-menu/components/web/HideSelfViewVideoButton.tsx
@@ -7,7 +7,7 @@ import { translate } from '../../../base/i18n/functions';
import { updateSettings } from '../../../base/settings/actions';
import { getHideSelfView } from '../../../base/settings/functions';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
/**
* The type of the React {@code Component} props of {@link HideSelfViewVideoButton}.
diff --git a/react/features/video-menu/components/web/KickButton.tsx b/react/features/video-menu/components/web/KickButton.tsx
index e8303b1b20..6f9657960b 100644
--- a/react/features/video-menu/components/web/KickButton.tsx
+++ b/react/features/video-menu/components/web/KickButton.tsx
@@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux';
import { openDialog } from '../../../base/dialog/actions';
import { IconUserDeleted } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
import KickRemoteParticipantDialog from './KickRemoteParticipantDialog';
diff --git a/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx b/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx
index 8758591883..e0e366e7e3 100644
--- a/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx
+++ b/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx
@@ -4,7 +4,6 @@ import { batch, connect, useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import { IReduxState, IStore } from '../../../app/types';
-import { getButtonNotifyMode, getParticipantMenuButtonsWithNotifyClick } from '../../../base/config/functions.web';
import { isMobileBrowser } from '../../../base/environment/utils';
import { IconDotsHorizontal } from '../../../base/icons/svg';
import { getLocalParticipant, getParticipantCount } from '../../../base/participants/functions';
@@ -18,7 +17,8 @@ import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuIte
import ConnectionIndicatorContent from '../../../connection-indicator/components/web/ConnectionIndicatorContent';
import { THUMBNAIL_TYPE } from '../../../filmstrip/constants';
import { isStageFilmstripAvailable } from '../../../filmstrip/functions.web';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { getParticipantMenuButtonsWithNotifyClick } from '../../../toolbox/functions.web';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { renderConnectionStatus } from '../../actions.web';
import { PARTICIPANT_MENU_BUTTONS as BUTTONS } from '../../constants';
@@ -154,7 +154,7 @@ const LocalVideoMenuTriggerButton = ({
const notifyClick = useCallback(
(buttonKey: string) => {
- const notifyMode = getButtonNotifyMode(buttonKey, buttonsWithNotifyClick);
+ const notifyMode = buttonsWithNotifyClick?.get(buttonKey);
if (!notifyMode) {
return;
@@ -165,7 +165,7 @@ const LocalVideoMenuTriggerButton = ({
_localParticipantId,
notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
);
- }, [ buttonsWithNotifyClick, getButtonNotifyMode ]);
+ }, [ buttonsWithNotifyClick ]);
const _onPopoverOpen = useCallback(() => {
showPopover?.();
@@ -193,7 +193,7 @@ const LocalVideoMenuTriggerButton = ({
className = { _overflowDrawer ? classes.flipText : '' }
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.FLIP_LOCAL_VIDEO) }
- notifyMode = { getButtonNotifyMode(BUTTONS.FLIP_LOCAL_VIDEO, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.FLIP_LOCAL_VIDEO) }
onClick = { hidePopover } />
}
{_showHideSelfViewButton
@@ -201,7 +201,7 @@ const LocalVideoMenuTriggerButton = ({
className = { _overflowDrawer ? classes.flipText : '' }
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.HIDE_SELF_VIEW) }
- notifyMode = { getButtonNotifyMode(BUTTONS.HIDE_SELF_VIEW, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.HIDE_SELF_VIEW) }
onClick = { hidePopover } />
}
{
@@ -210,7 +210,7 @@ const LocalVideoMenuTriggerButton = ({
noIcon = { true }
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.PIN_TO_STAGE) }
- notifyMode = { getButtonNotifyMode(BUTTONS.PIN_TO_STAGE, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.PIN_TO_STAGE) }
onClick = { hidePopover }
participantID = { _localParticipantId } />
}
@@ -220,7 +220,7 @@ const LocalVideoMenuTriggerButton = ({
noIcon = { true }
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.DEMOTE) }
- notifyMode = { getButtonNotifyMode(BUTTONS.DEMOTE, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.DEMOTE) }
onClick = { hidePopover }
participantID = { _localParticipantId } />
}
@@ -228,7 +228,7 @@ const LocalVideoMenuTriggerButton = ({
isMobileBrowser() && <ConnectionStatusButton
// eslint-disable-next-line react/jsx-no-bind
notifyClick = { () => notifyClick(BUTTONS.CONN_STATUS) }
- notifyMode = { getButtonNotifyMode(BUTTONS.CONN_STATUS, buttonsWithNotifyClick) }
+ notifyMode = { buttonsWithNotifyClick?.get(BUTTONS.CONN_STATUS) }
participantID = { _localParticipantId } />
}
</ContextMenuItemGroup>
diff --git a/react/features/video-menu/components/web/MuteButton.tsx b/react/features/video-menu/components/web/MuteButton.tsx
index 1c1f66c981..97ad31e551 100644
--- a/react/features/video-menu/components/web/MuteButton.tsx
+++ b/react/features/video-menu/components/web/MuteButton.tsx
@@ -10,7 +10,7 @@ import { IconMicSlash } from '../../../base/icons/svg';
import { MEDIA_TYPE } from '../../../base/media/constants';
import { isRemoteTrackMuted } from '../../../base/tracks/functions.any';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { muteRemote } from '../../actions.any';
import { IButtonProps } from '../../types';
diff --git a/react/features/video-menu/components/web/MuteEveryoneElseButton.tsx b/react/features/video-menu/components/web/MuteEveryoneElseButton.tsx
index 77b9e79c06..752a20f123 100644
--- a/react/features/video-menu/components/web/MuteEveryoneElseButton.tsx
+++ b/react/features/video-menu/components/web/MuteEveryoneElseButton.tsx
@@ -7,7 +7,7 @@ import { sendAnalytics } from '../../../analytics/functions';
import { openDialog } from '../../../base/dialog/actions';
import { IconMicSlash } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
import MuteEveryoneDialog from './MuteEveryoneDialog';
diff --git a/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx b/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx
index daad6d735e..5daeee80a6 100644
--- a/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx
+++ b/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx
@@ -7,7 +7,7 @@ import { sendAnalytics } from '../../../analytics/functions';
import { openDialog } from '../../../base/dialog/actions';
import { IconVideoOff } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
import MuteEveryonesVideoDialog from './MuteEveryonesVideoDialog';
diff --git a/react/features/video-menu/components/web/MuteVideoButton.tsx b/react/features/video-menu/components/web/MuteVideoButton.tsx
index 1c5120183e..05a6e573a5 100644
--- a/react/features/video-menu/components/web/MuteVideoButton.tsx
+++ b/react/features/video-menu/components/web/MuteVideoButton.tsx
@@ -10,7 +10,7 @@ import { IconVideoOff } from '../../../base/icons/svg';
import { MEDIA_TYPE } from '../../../base/media/constants';
import { isRemoteTrackMuted } from '../../../base/tracks/functions.any';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
import MuteRemoteParticipantsVideoDialog from './MuteRemoteParticipantsVideoDialog';
diff --git a/react/features/video-menu/components/web/ParticipantContextMenu.tsx b/react/features/video-menu/components/web/ParticipantContextMenu.tsx
index cc7d3963f8..1e55ffba53 100644
--- a/react/features/video-menu/components/web/ParticipantContextMenu.tsx
+++ b/react/features/video-menu/components/web/ParticipantContextMenu.tsx
@@ -6,7 +6,6 @@ import { makeStyles } from 'tss-react/mui';
import { IReduxState, IStore } from '../../../app/types';
import { isSupported as isAvModerationSupported } from '../../../av-moderation/functions';
import Avatar from '../../../base/avatar/components/Avatar';
-import { getButtonNotifyMode, getParticipantMenuButtonsWithNotifyClick } from '../../../base/config/functions.web';
import { isIosMobileBrowser, isMobileBrowser } from '../../../base/environment/utils';
import { MEDIA_TYPE } from '../../../base/media/constants';
import { PARTICIPANT_ROLE } from '../../../base/participants/constants';
@@ -23,8 +22,8 @@ import { isStageFilmstripAvailable } from '../../../filmstrip/functions.web';
import { QUICK_ACTION_BUTTON } from '../../../participants-pane/constants';
import { getQuickActionButtonType, isForceMuted } from '../../../participants-pane/functions';
import { requestRemoteControl, stopController } from '../../../remote-control/actions';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
-import { showOverflowDrawer } from '../../../toolbox/functions.web';
+import { getParticipantMenuButtonsWithNotifyClick, showOverflowDrawer } from '../../../toolbox/functions.web';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { iAmVisitor } from '../../../visitors/functions';
import { PARTICIPANT_MENU_BUTTONS as BUTTONS } from '../../constants';
@@ -169,7 +168,7 @@ const ParticipantContextMenu = ({
const notifyClick = useCallback(
(buttonKey: string) => {
- const notifyMode = getButtonNotifyMode(buttonKey, buttonsWithNotifyClick);
+ const notifyMode = buttonsWithNotifyClick?.get(buttonKey);
if (!notifyMode) {
return;
@@ -180,7 +179,7 @@ const ParticipantContextMenu = ({
_getCurrentParticipantId(),
notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY
);
- }, [ buttonsWithNotifyClick, getButtonNotifyMode, _getCurrentParticipantId ]);
+ }, [ buttonsWithNotifyClick, _getCurrentParticipantId ]);
const onBreakoutRoomButtonClick = useCallback(() => {
onSelect(true);
@@ -202,9 +201,8 @@ const ParticipantContextMenu = ({
&& !isNaN(_volume);
const getButtonProps = useCallback((key: string) => {
- const notifyMode = getButtonNotifyMode(key, buttonsWithNotifyClick);
- const shouldNotifyClick = notifyMode !== NOTIFY_CLICK_MODE.ONLY_NOTIFY
- || notifyMode !== NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY;
+ const notifyMode = buttonsWithNotifyClick?.get(key);
+ const shouldNotifyClick = typeof notifyMode !== 'undefined';
return {
key,
@@ -212,7 +210,7 @@ const ParticipantContextMenu = ({
notifyClick: shouldNotifyClick ? () => notifyClick(key) : undefined,
participantID: _getCurrentParticipantId()
};
- }, [ _getCurrentParticipantId, buttonsWithNotifyClick, getButtonNotifyMode, notifyClick ]);
+ }, [ _getCurrentParticipantId, buttonsWithNotifyClick, notifyClick ]);
if (_isModerator) {
if (isModerationSupported) {
diff --git a/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx b/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx
index 145fed1b50..6d30e5a32d 100644
--- a/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx
+++ b/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx
@@ -11,8 +11,8 @@ import { getParticipantById } from '../../../base/participants/functions';
import { IParticipant } from '../../../base/participants/types';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { openChat } from '../../../chat/actions.web';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
import { isButtonEnabled } from '../../../toolbox/functions.web';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
interface IProps extends IButtonProps, WithTranslation {
diff --git a/react/features/video-menu/components/web/RemoteControlButton.tsx b/react/features/video-menu/components/web/RemoteControlButton.tsx
index b541e25031..6811947839 100644
--- a/react/features/video-menu/components/web/RemoteControlButton.tsx
+++ b/react/features/video-menu/components/web/RemoteControlButton.tsx
@@ -6,7 +6,7 @@ import { sendAnalytics } from '../../../analytics/functions';
import { translate } from '../../../base/i18n/functions';
import { IconRemoteControlStart, IconRemoteControlStop } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
// TODO: Move these enums into the store after further reactification of the
// non-react RemoteVideo component.
diff --git a/react/features/video-menu/components/web/SendToRoomButton.tsx b/react/features/video-menu/components/web/SendToRoomButton.tsx
index 2cc7b80469..80536e1f12 100644
--- a/react/features/video-menu/components/web/SendToRoomButton.tsx
+++ b/react/features/video-menu/components/web/SendToRoomButton.tsx
@@ -8,7 +8,7 @@ import { IconRingGroup } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { sendParticipantToRoom } from '../../../breakout-rooms/actions';
import { IRoom } from '../../../breakout-rooms/types';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
interface IProps extends IButtonProps {
diff --git a/react/features/video-menu/components/web/TogglePinToStageButton.tsx b/react/features/video-menu/components/web/TogglePinToStageButton.tsx
index f46d129d48..7f18a9c4ed 100644
--- a/react/features/video-menu/components/web/TogglePinToStageButton.tsx
+++ b/react/features/video-menu/components/web/TogglePinToStageButton.tsx
@@ -6,7 +6,7 @@ import { IconPin, IconPinned } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { togglePinStageParticipant } from '../../../filmstrip/actions.web';
import { getPinnedActiveParticipants } from '../../../filmstrip/functions.web';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
interface IProps extends IButtonProps {
diff --git a/react/features/video-menu/components/web/VerifyParticipantButton.tsx b/react/features/video-menu/components/web/VerifyParticipantButton.tsx
index 00d9ba2374..6146a17acc 100644
--- a/react/features/video-menu/components/web/VerifyParticipantButton.tsx
+++ b/react/features/video-menu/components/web/VerifyParticipantButton.tsx
@@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux';
import { IconCheck } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { startVerification } from '../../../e2ee/actions';
-import { NOTIFY_CLICK_MODE } from '../../../toolbox/constants';
+import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
import { IButtonProps } from '../../types';
/**