Selaa lähdekoodia

feat(prejoin): Hide invite link

master
Hristo Terezov 4 vuotta sitten
vanhempi
commit
5e4b8c747c

+ 24
- 2
react/features/prejoin/components/Prejoin.js Näytä tiedosto

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

+ 8
- 3
react/features/toolbox/functions.web.js Näytä tiedosto

21
  *
21
  *
22
  * @param {string} name - The name of the setting section as defined in
22
  * @param {string} name - The name of the setting section as defined in
23
  * interface_config.js.
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
 export function isButtonEnabled(name: string) {
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…
Peruuta
Tallenna