Explorar el Código

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
master
Shawn Chin hace 3 años
padre
commit
0d7ec9552b
No account linked to committer's email address

+ 3
- 2
react/features/participants-pane/components/MeetingParticipantList.js Ver fichero

@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
6 6
 import { useSelector } from 'react-redux';
7 7
 
8 8
 import { getParticipants } from '../../base/participants';
9
-import { findStyledAncestor } from '../functions';
9
+import { findStyledAncestor, shouldRenderInviteButton } from '../functions';
10 10
 
11 11
 import { InviteButton } from './InviteButton';
12 12
 import { MeetingParticipantContextMenu } from './MeetingParticipantContextMenu';
@@ -36,6 +36,7 @@ const initialState = Object.freeze(Object.create(null));
36 36
 export const MeetingParticipantList = () => {
37 37
     const isMouseOverMenu = useRef(false);
38 38
     const participants = useSelector(getParticipants, _.isEqual);
39
+    const showInviteButton = useSelector(shouldRenderInviteButton);
39 40
     const [ raiseContext, setRaiseContext ] = useState<RaiseContext>(initialState);
40 41
     const { t } = useTranslation();
41 42
 
@@ -86,7 +87,7 @@ export const MeetingParticipantList = () => {
86 87
     return (
87 88
     <>
88 89
         <Heading>{t('participantsPane.headings.participantsList', { count: participants.length })}</Heading>
89
-        <InviteButton />
90
+        {showInviteButton && <InviteButton />}
90 91
         <div>
91 92
             {participants.map(p => (
92 93
                 <MeetingParticipantItem

+ 16
- 0
react/features/participants-pane/functions.js Ver fichero

@@ -1,3 +1,7 @@
1
+
2
+import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
3
+import { toState } from '../base/redux';
4
+
1 5
 import { REDUCER_KEY } from './constants';
2 6
 
3 7
 /**
@@ -64,3 +68,15 @@ const getState = state => state[REDUCER_KEY];
64 68
  */
65 69
 export const getParticipantsPaneOpen = state => Boolean(getState(state)?.isOpen);
66 70
 
71
+/**
72
+ * Returns true if the invite button should be rendered.
73
+ *
74
+ * @param {Object} state - Global state.
75
+ * @returns {boolean}
76
+ */
77
+export const shouldRenderInviteButton = state => {
78
+    const { disableInviteFunctions } = toState(state)['features/base/config'];
79
+    const flagEnabled = getFeatureFlag(state, INVITE_ENABLED, true);
80
+
81
+    return flagEnabled && !disableInviteFunctions;
82
+};

Loading…
Cancelar
Guardar