Bläddra i källkod

fix(overflow-menu) hide "more moderation controls" option if moderator settings tab disabled

master
Shawn Chin 3 år sedan
förälder
incheckning
a2425f71dd
Inget konto är kopplat till bidragsgivarens mejladress

+ 16
- 9
react/features/participants-pane/components/web/FooterContextMenu.js Visa fil

@@ -27,7 +27,11 @@ import {
27 27
     getParticipantCount,
28 28
     isEveryoneModerator
29 29
 } from '../../../base/participants';
30
-import { openSettingsDialog, SETTINGS_TABS } from '../../../settings';
30
+import {
31
+    SETTINGS_TABS,
32
+    openSettingsDialog,
33
+    shouldShowModeratorSettings
34
+} from '../../../settings';
31 35
 import { MuteEveryonesVideoDialog } from '../../../video-menu/components';
32 36
 
33 37
 const useStyles = makeStyles(theme => {
@@ -81,6 +85,7 @@ export const FooterContextMenu = ({ isOpen, onDrawerClose, onMouseLeave }: Props
81 85
     const dispatch = useDispatch();
82 86
     const isModerationSupported = useSelector(isAvModerationSupported());
83 87
     const allModerators = useSelector(isEveryoneModerator);
88
+    const isModeratorSettingsTabEnabled = useSelector(shouldShowModeratorSettings);
84 89
     const participantCount = useSelector(getParticipantCount);
85 90
     const isAudioModerationEnabled = useSelector(isAvModerationEnabled(MEDIA_TYPE.AUDIO));
86 91
     const isVideoModerationEnabled = useSelector(isAvModerationEnabled(MEDIA_TYPE.VIDEO));
@@ -146,14 +151,16 @@ export const FooterContextMenu = ({ isOpen, onDrawerClose, onMouseLeave }: Props
146 151
                     </div>
147 152
                 </ContextMenuItemGroup>
148 153
             )}
149
-            <ContextMenuItemGroup
150
-                actions = { [ {
151
-                    accessibilityLabel: t('participantsPane.actions.moreModerationControls'),
152
-                    id: 'participants-pane-open-moderation-control-settings',
153
-                    icon: IconHorizontalPoints,
154
-                    onClick: openModeratorSettings,
155
-                    text: t('participantsPane.actions.moreModerationControls')
156
-                } ] } />
154
+            {isModeratorSettingsTabEnabled && (
155
+                <ContextMenuItemGroup
156
+                    actions = { [ {
157
+                        accessibilityLabel: t('participantsPane.actions.moreModerationControls'),
158
+                        id: 'participants-pane-open-moderation-control-settings',
159
+                        icon: IconHorizontalPoints,
160
+                        onClick: openModeratorSettings,
161
+                        text: t('participantsPane.actions.moreModerationControls')
162
+                    } ] } />
163
+            )}
157 164
         </ContextMenu>
158 165
     );
159 166
 };

+ 17
- 7
react/features/settings/functions.js Visa fil

@@ -153,16 +153,11 @@ export function getModeratorTabProps(stateful: Object | Function) {
153 153
     } = state['features/base/conference'];
154 154
     const { disableReactionsModeration } = state['features/base/config'];
155 155
     const followMeActive = isFollowMeActive(state);
156
-    const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
157
-
158
-    const showModeratorSettings = Boolean(
159
-        conference
160
-        && configuredTabs.includes('moderator')
161
-        && isLocalParticipantModerator(state));
156
+    const showModeratorSettings = shouldShowModeratorSettings(state);
162 157
 
163 158
     // The settings sections to display.
164 159
     return {
165
-        showModeratorSettings,
160
+        showModeratorSettings: Boolean(conference && showModeratorSettings),
166 161
         disableReactionsModeration: Boolean(disableReactionsModeration),
167 162
         followMeActive: Boolean(conference && followMeActive),
168 163
         followMeEnabled: Boolean(conference && followMeEnabled),
@@ -172,6 +167,21 @@ export function getModeratorTabProps(stateful: Object | Function) {
172 167
     };
173 168
 }
174 169
 
170
+/**
171
+ * Returns true if moderator tab in settings should be visible/accessible.
172
+ *
173
+ * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
174
+ * {@code getState} function to be used to retrieve the state.
175
+ * @returns {boolean} True to indicate that moderator tab should be visible, false otherwise.
176
+ */
177
+export function shouldShowModeratorSettings(stateful: Object | Function) {
178
+    const state = toState(stateful);
179
+
180
+    return Boolean(
181
+        isSettingEnabled('moderator')
182
+        && isLocalParticipantModerator(state));
183
+}
184
+
175 185
 /**
176 186
  * Returns the properties for the "Profile" tab from settings dialog from Redux
177 187
  * state.

Laddar…
Avbryt
Spara