소스 검색

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 3 년 전
부모
커밋
0d7ec9552b
No account linked to committer's email address
2개의 변경된 파일19개의 추가작업 그리고 2개의 파일을 삭제
  1. 3
    2
      react/features/participants-pane/components/MeetingParticipantList.js
  2. 16
    0
      react/features/participants-pane/functions.js

+ 3
- 2
react/features/participants-pane/components/MeetingParticipantList.js 파일 보기

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

+ 16
- 0
react/features/participants-pane/functions.js 파일 보기

1
+
2
+import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
3
+import { toState } from '../base/redux';
4
+
1
 import { REDUCER_KEY } from './constants';
5
 import { REDUCER_KEY } from './constants';
2
 
6
 
3
 /**
7
 /**
64
  */
68
  */
65
 export const getParticipantsPaneOpen = state => Boolean(getState(state)?.isOpen);
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…
취소
저장