Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Hide invite button in participant panel if disabled in config (#9287)

Shawn Chin0d7ec9552b9c
diff --git a/react/features/participants-pane/components/MeetingParticipantList.js b/react/features/participants-pane/components/MeetingParticipantList.js
index 462402c930..bb11e8e7fe 100644
--- a/react/features/participants-pane/components/MeetingParticipantList.js
+++ b/react/features/participants-pane/components/MeetingParticipantList.js
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { getParticipants } from '../../base/participants';
-import { findStyledAncestor } from '../functions';
+import { findStyledAncestor, shouldRenderInviteButton } from '../functions';
import { InviteButton } from './InviteButton';
import { MeetingParticipantContextMenu } from './MeetingParticipantContextMenu';
@@ -36,6 +36,7 @@ const initialState = Object.freeze(Object.create(null));
export const MeetingParticipantList = () => {
const isMouseOverMenu = useRef(false);
const participants = useSelector(getParticipants, _.isEqual);
+ const showInviteButton = useSelector(shouldRenderInviteButton);
const [ raiseContext, setRaiseContext ] = useState<RaiseContext>(initialState);
const { t } = useTranslation();
@@ -86,7 +87,7 @@ export const MeetingParticipantList = () => {
return (
<>
<Heading>{t('participantsPane.headings.participantsList', { count: participants.length })}</Heading>
- <InviteButton />
+ {showInviteButton && <InviteButton />}
<div>
{participants.map(p => (
<MeetingParticipantItem
diff --git a/react/features/participants-pane/functions.js b/react/features/participants-pane/functions.js
index bced1dacb1..3270433521 100644
--- a/react/features/participants-pane/functions.js
+++ b/react/features/participants-pane/functions.js
@@ -1,3 +1,7 @@
+
+import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
+import { toState } from '../base/redux';
+
import { REDUCER_KEY } from './constants';
/**
@@ -64,3 +68,15 @@ const getState = state => state[REDUCER_KEY];
*/
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;
+};