From 9b5eae7a607fa58c721daf19cb9e532eb21a1680 Mon Sep 17 00:00:00 2001 From: Calinteodor Date: Fri, 14 May 2021 16:01:43 +0300 Subject: [PATCH] feat(rn, security) added flag for controlling security options button visibility --- react/features/base/flags/constants.js | 14 +++++++++++++- .../security-dialog/SecurityDialogButton.js | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/react/features/base/flags/constants.js b/react/features/base/flags/constants.js index f3acc2be1..8e6deba52 100644 --- a/react/features/base/flags/constants.js +++ b/react/features/base/flags/constants.js @@ -104,6 +104,12 @@ export const KICK_OUT_ENABLED = 'kick-out.enabled'; */ export const LIVE_STREAMING_ENABLED = 'live-streaming.enabled'; +/** + * Flag indicating if lobby mode button should be enabled. + * Default: enabled. + */ +export const LOBBY_MODE_ENABLED = 'lobby-mode.enabled'; + /** * Flag indicating if displaying the meeting name should be enabled. * Default: enabled (true). @@ -113,7 +119,7 @@ export const MEETING_NAME_ENABLED = 'meeting-name.enabled'; /** * Flag indicating if the meeting password button should be enabled. * Note that this flag just decides on the button, if a meeting has a password - * set, the password ddialog will still show up. + * set, the password dialog will still show up. * Default: enabled (true). */ export const MEETING_PASSWORD_ENABLED = 'meeting-password.enabled'; @@ -155,6 +161,12 @@ export const RECORDING_ENABLED = 'recording.enabled'; */ export const RESOLUTION = 'resolution'; +/** + * Flag indicating if the security options button should be enabled. + * Default: enabled (true) + */ +export const SECURITY_OPTIONS_ENABLED = 'security-options.enabled'; + /** * Flag indicating if server URL change is enabled. * Default: enabled (true) diff --git a/react/features/security/components/security-dialog/SecurityDialogButton.js b/react/features/security/components/security-dialog/SecurityDialogButton.js index a7da1520a..6704824ef 100644 --- a/react/features/security/components/security-dialog/SecurityDialogButton.js +++ b/react/features/security/components/security-dialog/SecurityDialogButton.js @@ -3,8 +3,15 @@ import type { Dispatch } from 'redux'; import { createToolbarEvent, sendAnalytics } from '../../../analytics'; +import { + getFeatureFlag, + LOBBY_MODE_ENABLED, + MEETING_PASSWORD_ENABLED, + SECURITY_OPTIONS_ENABLED +} from '../../../base/flags'; import { translate } from '../../../base/i18n'; import { IconSecurityOff, IconSecurityOn } from '../../../base/icons'; +import { isLocalParticipantModerator } from '../../../base/participants'; import { connect } from '../../../base/redux'; import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components'; import { toggleSecurityDialog } from '../../actions'; @@ -62,11 +69,19 @@ class SecurityDialogButton extends AbstractButton { * @returns {Props} */ function mapStateToProps(state: Object) { + const { conference } = state['features/base/conference']; + const { hideLobbyButton } = state['features/base/config']; const { locked } = state['features/base/conference']; const { lobbyEnabled } = state['features/lobby']; + const lobbySupported = conference && conference.isLobbySupported(); + const lobby = lobbySupported && isLocalParticipantModerator(state) && !hideLobbyButton; + const enabledFlag = getFeatureFlag(state, SECURITY_OPTIONS_ENABLED, true); + const enabledLobbyModeFlag = getFeatureFlag(state, LOBBY_MODE_ENABLED, true) && lobby; + const enabledMeetingPassFlag = getFeatureFlag(state, MEETING_PASSWORD_ENABLED, true); return { - _locked: locked || lobbyEnabled + _locked: locked || lobbyEnabled, + visible: enabledFlag || (enabledLobbyModeFlag || enabledMeetingPassFlag) }; }