Hide invite button in participant panel if disabled in config (#9287)
* Hide invite button in participant panel if disabled in config * match code style, fix lint errors
This commit is contained in:
parent
e5a3f8505e
commit
0d7ec9552b
|
@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { getParticipants } from '../../base/participants';
|
import { getParticipants } from '../../base/participants';
|
||||||
import { findStyledAncestor } from '../functions';
|
import { findStyledAncestor, shouldRenderInviteButton } from '../functions';
|
||||||
|
|
||||||
import { InviteButton } from './InviteButton';
|
import { InviteButton } from './InviteButton';
|
||||||
import { MeetingParticipantContextMenu } from './MeetingParticipantContextMenu';
|
import { MeetingParticipantContextMenu } from './MeetingParticipantContextMenu';
|
||||||
|
@ -36,6 +36,7 @@ const initialState = Object.freeze(Object.create(null));
|
||||||
export const MeetingParticipantList = () => {
|
export const MeetingParticipantList = () => {
|
||||||
const isMouseOverMenu = useRef(false);
|
const isMouseOverMenu = useRef(false);
|
||||||
const participants = useSelector(getParticipants, _.isEqual);
|
const participants = useSelector(getParticipants, _.isEqual);
|
||||||
|
const showInviteButton = useSelector(shouldRenderInviteButton);
|
||||||
const [ raiseContext, setRaiseContext ] = useState<RaiseContext>(initialState);
|
const [ raiseContext, setRaiseContext ] = useState<RaiseContext>(initialState);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ export const MeetingParticipantList = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Heading>{t('participantsPane.headings.participantsList', { count: participants.length })}</Heading>
|
<Heading>{t('participantsPane.headings.participantsList', { count: participants.length })}</Heading>
|
||||||
<InviteButton />
|
{showInviteButton && <InviteButton />}
|
||||||
<div>
|
<div>
|
||||||
{participants.map(p => (
|
{participants.map(p => (
|
||||||
<MeetingParticipantItem
|
<MeetingParticipantItem
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
|
||||||
|
import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
|
||||||
|
import { toState } from '../base/redux';
|
||||||
|
|
||||||
import { REDUCER_KEY } from './constants';
|
import { REDUCER_KEY } from './constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,3 +68,15 @@ const getState = state => state[REDUCER_KEY];
|
||||||
*/
|
*/
|
||||||
export const getParticipantsPaneOpen = state => Boolean(getState(state)?.isOpen);
|
export const getParticipantsPaneOpen = state => Boolean(getState(state)?.isOpen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the invite button should be rendered.
|
||||||
|
*
|
||||||
|
* @param {Object} state - Global state.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export const shouldRenderInviteButton = state => {
|
||||||
|
const { disableInviteFunctions } = toState(state)['features/base/config'];
|
||||||
|
const flagEnabled = getFeatureFlag(state, INVITE_ENABLED, true);
|
||||||
|
|
||||||
|
return flagEnabled && !disableInviteFunctions;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue