Browse Source

feat(config/flag): enable/disable participants pane

factor2
Calin-Teodor 1 year ago
parent
commit
aff671b44a

+ 2
- 0
config.js View File

@@ -1388,6 +1388,8 @@ var config = {
1388 1388
 
1389 1389
     // Options related to the participants pane.
1390 1390
     // participantsPane: {
1391
+    //     // Enables feature
1392
+    //     enabled: true,
1391 1393
     //     // Hides the moderator settings tab.
1392 1394
     //     hideModeratorSettingsTab: false,
1393 1395
     //     // Hides the more actions button.

+ 1
- 0
react/features/base/config/configType.ts View File

@@ -503,6 +503,7 @@ export interface IConfig {
503 503
         preventExecution: boolean;
504 504
     }>;
505 505
     participantsPane?: {
506
+        enabled?: boolean;
506 507
         hideModeratorSettingsTab?: boolean;
507 508
         hideMoreActionsButton?: boolean;
508 509
         hideMuteAllButton?: boolean;

+ 6
- 0
react/features/base/flags/constants.ts View File

@@ -164,6 +164,12 @@ export const NOTIFICATIONS_ENABLED = 'notifications.enabled';
164 164
  */
165 165
 export const OVERFLOW_MENU_ENABLED = 'overflow-menu.enabled';
166 166
 
167
+/**
168
+ * Flag indicating if participants should be enabled.
169
+ * Default: enabled (true).
170
+ */
171
+export const PARTICIPANTS_ENABLED = 'participants.enabled';
172
+
167 173
 /**
168 174
  * Flag indicating if Picture-in-Picture should be enabled.
169 175
  * Default: auto-detected.

+ 15
- 4
react/features/conference/components/native/TitleBar.tsx View File

@@ -9,6 +9,7 @@ import { getFeatureFlag } from '../../../base/flags/functions';
9 9
 import AudioDeviceToggleButton from '../../../mobile/audio-mode/components/AudioDeviceToggleButton';
10 10
 import PictureInPictureButton from '../../../mobile/picture-in-picture/components/PictureInPictureButton';
11 11
 import ParticipantsPaneButton from '../../../participants-pane/components/native/ParticipantsPaneButton';
12
+import { isParticipantsPaneEnabled } from '../../../participants-pane/functions';
12 13
 import { isRoomNameEnabled } from '../../../prejoin/functions';
13 14
 import ToggleCameraButton from '../../../toolbox/components/native/ToggleCameraButton';
14 15
 import { isToolboxVisible } from '../../../toolbox/functions.native';
@@ -31,6 +32,11 @@ interface IProps {
31 32
      */
32 33
     _createOnPress: Function;
33 34
 
35
+    /**
36
+     * Whether participants feature is enabled or not.
37
+     */
38
+    _isParticipantsPaneEnabled: boolean;
39
+
34 40
     /**
35 41
      * Name of the meeting we're currently in.
36 42
      */
@@ -55,7 +61,7 @@ interface IProps {
55 61
  * @returns {JSX.Element}
56 62
  */
57 63
 const TitleBar = (props: IProps) => {
58
-    const { _visible } = props;
64
+    const { _isParticipantsPaneEnabled, _visible } = props;
59 65
 
60 66
     if (!_visible) {
61 67
         return null;
@@ -95,9 +101,13 @@ const TitleBar = (props: IProps) => {
95 101
             <View style = { styles.titleBarButtonContainer }>
96 102
                 <AudioDeviceToggleButton styles = { styles.titleBarButton } />
97 103
             </View>
98
-            <View style = { styles.titleBarButtonContainer }>
99
-                <ParticipantsPaneButton styles = { styles.titleBarButton } />
100
-            </View>
104
+            {
105
+                _isParticipantsPaneEnabled
106
+                && <View style = { styles.titleBarButtonContainer }>
107
+                    <ParticipantsPaneButton
108
+                        styles = { styles.titleBarButton } />
109
+                </View>
110
+            }
101 111
         </View>
102 112
     );
103 113
 };
@@ -115,6 +125,7 @@ function _mapStateToProps(state: IReduxState) {
115 125
     return {
116 126
         _conferenceTimerEnabled:
117 127
             Boolean(getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer && startTimestamp),
128
+        _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state),
118 129
         _meetingName: getConferenceName(state),
119 130
         _roomNameEnabled: isRoomNameEnabled(state),
120 131
         _visible: isToolboxVisible(state)

+ 16
- 2
react/features/participants-pane/components/web/ParticipantsPaneButton.tsx View File

@@ -9,9 +9,11 @@ import {
9 9
     close as closeParticipantsPane,
10 10
     open as openParticipantsPane
11 11
 } from '../../../participants-pane/actions.web';
12
+import { isParticipantsPaneEnabled } from '../../functions';
12 13
 
13 14
 import ParticipantsCounter from './ParticipantsCounter';
14 15
 
16
+
15 17
 /**
16 18
  * The type of the React {@code Component} props of {@link ParticipantsPaneButton}.
17 19
  */
@@ -21,6 +23,11 @@ interface IProps extends AbstractButtonProps {
21 23
      * Whether or not the participants pane is open.
22 24
      */
23 25
     _isOpen: boolean;
26
+
27
+    /**
28
+     * Whether participants feature is enabled or not.
29
+     */
30
+    _isParticipantsPaneEnabled: boolean;
24 31
 }
25 32
 
26 33
 /**
@@ -69,10 +76,16 @@ class ParticipantsPaneButton extends AbstractButton<IProps> {
69 76
      * @returns {React$Node}
70 77
      */
71 78
     render() {
79
+        const { _isParticipantsPaneEnabled } = this.props;
80
+
81
+        if (!_isParticipantsPaneEnabled) {
82
+            return null;
83
+        }
84
+
72 85
         return (
73 86
             <div
74 87
                 className = 'toolbar-button-with-badge'>
75
-                {super.render()}
88
+                { super.render() }
76 89
                 <ParticipantsCounter />
77 90
             </div>
78 91
         );
@@ -89,7 +102,8 @@ function mapStateToProps(state: IReduxState) {
89 102
     const { isOpen } = state['features/participants-pane'];
90 103
 
91 104
     return {
92
-        _isOpen: isOpen
105
+        _isOpen: isOpen,
106
+        _isParticipantsPaneEnabled: isParticipantsPaneEnabled(state)
93 107
     };
94 108
 }
95 109
 

+ 15
- 1
react/features/participants-pane/functions.ts View File

@@ -7,7 +7,7 @@ import {
7 7
 } from '../av-moderation/functions';
8 8
 import { IStateful } from '../base/app/types';
9 9
 import { getCurrentConference } from '../base/conference/functions';
10
-import { INVITE_ENABLED } from '../base/flags/constants';
10
+import { INVITE_ENABLED, PARTICIPANTS_ENABLED } from '../base/flags/constants';
11 11
 import { getFeatureFlag } from '../base/flags/functions';
12 12
 import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
13 13
 import {
@@ -309,3 +309,17 @@ export function isBreakoutRoomRenameAllowed(state: IReduxState) {
309 309
 
310 310
     return isLocalModerator && isRenameBreakoutRoomsSupported;
311 311
 }
312
+
313
+/**
314
+ * Returns true if participants is enabled and false otherwise.
315
+ *
316
+ * @param {IStateful} stateful - The redux store, the redux
317
+ * {@code getState} function, or the redux state itself.
318
+ * @returns {boolean}
319
+ */
320
+export const isParticipantsPaneEnabled = (stateful: IStateful) => {
321
+    const state = toState(stateful);
322
+    const { enabled = true } = getParticipantsPaneConfig(state);
323
+
324
+    return Boolean(getFeatureFlag(state, PARTICIPANTS_ENABLED, true) && enabled);
325
+};

+ 6
- 2
react/features/toolbox/hooks.web.ts View File

@@ -17,7 +17,10 @@ import {
17 17
     close as closeParticipantsPane,
18 18
     open as openParticipantsPane
19 19
 } from '../participants-pane/actions.web';
20
-import { getParticipantsPaneOpen } from '../participants-pane/functions';
20
+import {
21
+    getParticipantsPaneOpen,
22
+    isParticipantsPaneEnabled
23
+} from '../participants-pane/functions';
21 24
 import { addReactionToBuffer } from '../reactions/actions.any';
22 25
 import { toggleReactionsMenuVisibility } from '../reactions/actions.web';
23 26
 import { REACTIONS } from '../reactions/constants';
@@ -36,6 +39,7 @@ import { isDesktopShareButtonDisabled } from './functions.web';
36 39
 export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {
37 40
     const dispatch = useDispatch();
38 41
     const _isSpeakerStatsDisabled = useSelector(isSpeakerStatsDisabled);
42
+    const _isParticipantsPaneEnabled = useSelector(isParticipantsPaneEnabled);
39 43
     const _shouldDisplayReactionsButtons = useSelector(shouldDisplayReactionsButtons);
40 44
     const _toolbarButtons = useSelector((state: IReduxState) => toolbarButtons || getToolbarButtons(state));
41 45
     const chatOpen = useSelector((state: IReduxState) => state['features/chat'].isOpen);
@@ -216,7 +220,7 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {
216 220
                 exec: onToggleScreenshare,
217 221
                 helpDescription: 'keyboardShortcuts.toggleScreensharing'
218 222
             },
219
-            isToolbarButtonEnabled('participants-pane', _toolbarButtons) && {
223
+            _isParticipantsPaneEnabled && isToolbarButtonEnabled('participants-pane', _toolbarButtons) && {
220 224
                 character: 'P',
221 225
                 exec: onToggleParticipantsPane,
222 226
                 helpDescription: 'keyboardShortcuts.toggleParticipantsPane'

Loading…
Cancel
Save