소스 검색

feat(prejoin): Hide invite link

master
Hristo Terezov 4 년 전
부모
커밋
5e4b8c747c
2개의 변경된 파일32개의 추가작업 그리고 5개의 파일을 삭제
  1. 24
    2
      react/features/prejoin/components/Prejoin.js
  2. 8
    3
      react/features/toolbox/functions.web.js

+ 24
- 2
react/features/prejoin/components/Prejoin.js 파일 보기

@@ -11,6 +11,7 @@ import { ActionButton, InputField, PreMeetingScreen, ToggleButton } from '../../
11 11
 import { connect } from '../../base/redux';
12 12
 import { getDisplayName, updateSettings } from '../../base/settings';
13 13
 import { getLocalJitsiVideoTrack } from '../../base/tracks';
14
+import { isButtonEnabled } from '../../toolbox/functions.web';
14 15
 import {
15 16
     joinConference as joinConferenceAction,
16 17
     joinConferenceWithoutAudio as joinConferenceWithoutAudioAction,
@@ -28,6 +29,8 @@ import {
28 29
 import JoinByPhoneDialog from './dialogs/JoinByPhoneDialog';
29 30
 import DeviceStatus from './preview/DeviceStatus';
30 31
 
32
+declare var interfaceConfig: Object;
33
+
31 34
 type Props = {
32 35
 
33 36
     /**
@@ -100,6 +103,11 @@ type Props = {
100 103
      */
101 104
     showJoinActions: boolean,
102 105
 
106
+    /**
107
+     * Flag signaling the visibility of the conference URL section.
108
+     */
109
+    showConferenceInfo: boolean,
110
+
103 111
     /**
104 112
      * If 'JoinByPhoneDialog' is visible or not.
105 113
      */
@@ -139,6 +147,7 @@ class Prejoin extends Component<Props, State> {
139 147
      * @static
140 148
      */
141 149
     static defaultProps = {
150
+        showConferenceInfo: true,
142 151
         showJoinActions: true,
143 152
         showSkipPrejoin: true
144 153
     };
@@ -257,6 +266,7 @@ class Prejoin extends Component<Props, State> {
257 266
             showAvatar,
258 267
             showCameraPreview,
259 268
             showDialog,
269
+            showConferenceInfo,
260 270
             showJoinActions,
261 271
             t,
262 272
             videoTrack
@@ -270,7 +280,7 @@ class Prejoin extends Component<Props, State> {
270 280
                 footer = { this._renderFooter() }
271 281
                 name = { name }
272 282
                 showAvatar = { showAvatar }
273
-                showConferenceInfo = { showJoinActions }
283
+                showConferenceInfo = { showConferenceInfo }
274 284
                 skipPrejoinButton = { this._renderSkipPrejoinButton() }
275 285
                 title = { t('prejoin.joinMeeting') }
276 286
                 videoMuted = { !showCameraPreview }
@@ -368,11 +378,22 @@ class Prejoin extends Component<Props, State> {
368 378
  * Maps (parts of) the redux state to the React {@code Component} props.
369 379
  *
370 380
  * @param {Object} state - The redux state.
381
+ * @param {Object} ownProps - The props passed to the component.
371 382
  * @returns {Object}
372 383
  */
373
-function mapStateToProps(state): Object {
384
+function mapStateToProps(state, ownProps): Object {
374 385
     const name = getDisplayName(state);
375 386
     const joinButtonDisabled = isDisplayNameRequired(state) && !name;
387
+    const { showJoinActions } = ownProps;
388
+    const isInviteButtonEnabled = isButtonEnabled('invite');
389
+
390
+    // Hide conference info when interfaceConfig is available and the invite button is disabled.
391
+    // In all other cases we want to preserve the behaviour and control the the conference info
392
+    // visibility trough showJoinActions.
393
+    const showConferenceInfo
394
+        = typeof isInviteButtonEnabled === 'undefined' || isInviteButtonEnabled === true
395
+            ? showJoinActions
396
+            : false;
376 397
 
377 398
     return {
378 399
         buttonIsToggled: isPrejoinSkipped(state),
@@ -383,6 +404,7 @@ function mapStateToProps(state): Object {
383 404
         showDialog: isJoinByPhoneDialogVisible(state),
384 405
         hasJoinByPhoneButton: isJoinByPhoneButtonVisible(state),
385 406
         showCameraPreview: !isVideoMutedByUser(state),
407
+        showConferenceInfo,
386 408
         videoTrack: getLocalJitsiVideoTrack(state)
387 409
     };
388 410
 }

+ 8
- 3
react/features/toolbox/functions.web.js 파일 보기

@@ -21,11 +21,16 @@ export function getToolboxHeight() {
21 21
  *
22 22
  * @param {string} name - The name of the setting section as defined in
23 23
  * interface_config.js.
24
- * @returns {boolean} - True to indicate that the given toolbar button
25
- * is enabled, false - otherwise.
24
+ * @returns {boolean|undefined} - True to indicate that the given toolbar button
25
+ * is enabled, false - otherwise. In cases where interfaceConfig is not available
26
+ * undefined is returned.
26 27
  */
27 28
 export function isButtonEnabled(name: string) {
28
-    return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
29
+    if (typeof interfaceConfig === 'object' && Array.isArray(interfaceConfig.TOOLBAR_BUTTONS)) {
30
+        return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
31
+    }
32
+
33
+    return undefined;
29 34
 }
30 35
 
31 36
 

Loading…
취소
저장