Преглед изворни кода

feat: private message interface config flag

master
Bettenbuk Zoltan пре 6 година
родитељ
комит
53f01a39c9

+ 1
- 0
react/features/base/config/interfaceConfigWhitelist.js Прегледај датотеку

@@ -22,6 +22,7 @@ export default [
22 22
     'DEFAULT_REMOTE_DISPLAY_NAME',
23 23
     'DISABLE_DOMINANT_SPEAKER_INDICATOR',
24 24
     'DISABLE_FOCUS_INDICATOR',
25
+    'DISABLE_PRIVATE_MESSAGES',
25 26
     'DISABLE_RINGING',
26 27
     'DISABLE_TRANSCRIPTION_SUBTITLES',
27 28
     'DISABLE_VIDEO_BACKGROUND',

+ 36
- 2
react/features/remote-video-menu/components/web/PrivateMessageMenuButton.js Прегледај датотеку

@@ -5,10 +5,25 @@ import React, { Component } from 'react';
5 5
 import { translate } from '../../../base/i18n';
6 6
 import { IconMessage } from '../../../base/icons';
7 7
 import { connect } from '../../../base/redux';
8
-import { _mapDispatchToProps, _mapStateToProps, type Props } from '../../../chat/components/PrivateMessageButton';
8
+import {
9
+    _mapDispatchToProps,
10
+    _mapStateToProps as _abstractMapStateToProps,
11
+    type Props as AbstractProps
12
+} from '../../../chat/components/PrivateMessageButton';
13
+import { isButtonEnabled } from '../../../toolbox';
9 14
 
10 15
 import RemoteVideoMenuButton from './RemoteVideoMenuButton';
11 16
 
17
+declare var interfaceConfig: Object;
18
+
19
+type Props = AbstractProps & {
20
+
21
+    /**
22
+     * True if the private chat functionality is disabled, hence the button is not visible.
23
+     */
24
+    _hidden: boolean
25
+};
26
+
12 27
 /**
13 28
  * A custom implementation of the PrivateMessageButton specialized for
14 29
  * the web version of the remote video menu. When the web platform starts to use
@@ -34,7 +49,11 @@ class PrivateMessageMenuButton extends Component<Props> {
34 49
      * @returns {ReactElement}
35 50
      */
36 51
     render() {
37
-        const { participantID, t } = this.props;
52
+        const { participantID, t, _hidden } = this.props;
53
+
54
+        if (_hidden) {
55
+            return null;
56
+        }
38 57
 
39 58
         return (
40 59
             <RemoteVideoMenuButton
@@ -59,4 +78,19 @@ class PrivateMessageMenuButton extends Component<Props> {
59 78
     }
60 79
 }
61 80
 
81
+/**
82
+ * Maps part of the Redux store to the props of this component.
83
+ *
84
+ * @param {Object} state - The Redux state.
85
+ * @param {Props} ownProps - The own props of the component.
86
+ * @returns {Props}
87
+ */
88
+function _mapStateToProps(state: Object, ownProps: Props): $Shape<Props> {
89
+    return {
90
+        ..._abstractMapStateToProps(state, ownProps),
91
+        _hidden: typeof interfaceConfig !== 'undefined'
92
+            && (interfaceConfig.DISABLE_PRIVATE_MESSAGES || !isButtonEnabled('chat'))
93
+    };
94
+}
95
+
62 96
 export default translate(connect(_mapStateToProps, _mapDispatchToProps)(PrivateMessageMenuButton));

Loading…
Откажи
Сачувај