fix(overflow-menu) hide "more moderation controls" option if moderator settings tab disabled
This commit is contained in:
parent
c9941dedb9
commit
a2425f71dd
|
@ -27,7 +27,11 @@ import {
|
|||
getParticipantCount,
|
||||
isEveryoneModerator
|
||||
} from '../../../base/participants';
|
||||
import { openSettingsDialog, SETTINGS_TABS } from '../../../settings';
|
||||
import {
|
||||
SETTINGS_TABS,
|
||||
openSettingsDialog,
|
||||
shouldShowModeratorSettings
|
||||
} from '../../../settings';
|
||||
import { MuteEveryonesVideoDialog } from '../../../video-menu/components';
|
||||
|
||||
const useStyles = makeStyles(theme => {
|
||||
|
@ -81,6 +85,7 @@ export const FooterContextMenu = ({ isOpen, onDrawerClose, onMouseLeave }: Props
|
|||
const dispatch = useDispatch();
|
||||
const isModerationSupported = useSelector(isAvModerationSupported());
|
||||
const allModerators = useSelector(isEveryoneModerator);
|
||||
const isModeratorSettingsTabEnabled = useSelector(shouldShowModeratorSettings);
|
||||
const participantCount = useSelector(getParticipantCount);
|
||||
const isAudioModerationEnabled = useSelector(isAvModerationEnabled(MEDIA_TYPE.AUDIO));
|
||||
const isVideoModerationEnabled = useSelector(isAvModerationEnabled(MEDIA_TYPE.VIDEO));
|
||||
|
@ -146,6 +151,7 @@ export const FooterContextMenu = ({ isOpen, onDrawerClose, onMouseLeave }: Props
|
|||
</div>
|
||||
</ContextMenuItemGroup>
|
||||
)}
|
||||
{isModeratorSettingsTabEnabled && (
|
||||
<ContextMenuItemGroup
|
||||
actions = { [ {
|
||||
accessibilityLabel: t('participantsPane.actions.moreModerationControls'),
|
||||
|
@ -154,6 +160,7 @@ export const FooterContextMenu = ({ isOpen, onDrawerClose, onMouseLeave }: Props
|
|||
onClick: openModeratorSettings,
|
||||
text: t('participantsPane.actions.moreModerationControls')
|
||||
} ] } />
|
||||
)}
|
||||
</ContextMenu>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -153,16 +153,11 @@ export function getModeratorTabProps(stateful: Object | Function) {
|
|||
} = state['features/base/conference'];
|
||||
const { disableReactionsModeration } = state['features/base/config'];
|
||||
const followMeActive = isFollowMeActive(state);
|
||||
const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
|
||||
|
||||
const showModeratorSettings = Boolean(
|
||||
conference
|
||||
&& configuredTabs.includes('moderator')
|
||||
&& isLocalParticipantModerator(state));
|
||||
const showModeratorSettings = shouldShowModeratorSettings(state);
|
||||
|
||||
// The settings sections to display.
|
||||
return {
|
||||
showModeratorSettings,
|
||||
showModeratorSettings: Boolean(conference && showModeratorSettings),
|
||||
disableReactionsModeration: Boolean(disableReactionsModeration),
|
||||
followMeActive: Boolean(conference && followMeActive),
|
||||
followMeEnabled: Boolean(conference && followMeEnabled),
|
||||
|
@ -172,6 +167,21 @@ export function getModeratorTabProps(stateful: Object | Function) {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if moderator tab in settings should be visible/accessible.
|
||||
*
|
||||
* @param {(Function|Object)} stateful - The (whole) redux state, or redux's
|
||||
* {@code getState} function to be used to retrieve the state.
|
||||
* @returns {boolean} True to indicate that moderator tab should be visible, false otherwise.
|
||||
*/
|
||||
export function shouldShowModeratorSettings(stateful: Object | Function) {
|
||||
const state = toState(stateful);
|
||||
|
||||
return Boolean(
|
||||
isSettingEnabled('moderator')
|
||||
&& isLocalParticipantModerator(state));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the properties for the "Profile" tab from settings dialog from Redux
|
||||
* state.
|
||||
|
|
Loading…
Reference in New Issue