ソースを参照

fix(e2ee) fix showing not supported warning when alone

master
Saúl Ibarra Corretgé 4年前
コミット
ddbf334930
2個のファイルの変更33行の追加9行の削除
  1. 4
    9
      react/features/e2ee/components/E2EESection.js
  2. 29
    0
      react/features/e2ee/functions.js

+ 4
- 9
react/features/e2ee/components/E2EESection.js ファイルの表示

@@ -8,7 +8,7 @@ import { translate } from '../../base/i18n';
8 8
 import { Switch } from '../../base/react';
9 9
 import { connect } from '../../base/redux';
10 10
 import { toggleE2EE } from '../actions';
11
-
11
+import { doesEveryoneSupportE2EE } from '../functions';
12 12
 
13 13
 type Props = {
14 14
 
@@ -38,12 +38,7 @@ type State = {
38 38
     /**
39 39
      * True if the switch is toggled on.
40 40
      */
41
-    enabled: boolean,
42
-
43
-    /**
44
-     * True if the section description should be expanded, false otherwise.
45
-     */
46
-    expand: boolean
41
+    enabled: boolean
47 42
 };
48 43
 
49 44
 /**
@@ -147,11 +142,11 @@ class E2EESection extends Component<Props, State> {
147 142
  * @returns {Props}
148 143
  */
149 144
 function mapStateToProps(state) {
150
-    const { enabled, everyoneSupportE2EE } = state['features/e2ee'];
145
+    const { enabled } = state['features/e2ee'];
151 146
 
152 147
     return {
153 148
         _enabled: enabled,
154
-        _everyoneSupportE2EE: everyoneSupportE2EE
149
+        _everyoneSupportE2EE: doesEveryoneSupportE2EE(state)
155 150
     };
156 151
 }
157 152
 

+ 29
- 0
react/features/e2ee/functions.js ファイルの表示

@@ -0,0 +1,29 @@
1
+
2
+import { getParticipantCount } from '../base/participants/functions';
3
+import { toState } from '../base/redux';
4
+
5
+/**
6
+ * Gets the value of a specific React {@code Component} prop of the currently
7
+ * mounted {@link App}.
8
+ *
9
+ * @param {Function|Object} stateful - The redux store or {@code getState}
10
+ * function.
11
+ * @param {string} propName - The name of the React {@code Component} prop of
12
+ * the currently mounted {@code App} to get.
13
+ * @returns {*} The value of the specified React {@code Component} prop of the
14
+ * currently mounted {@code App}.
15
+ */
16
+export function doesEveryoneSupportE2EE(stateful) {
17
+    const state = toState(stateful);
18
+    const { everyoneSupportE2EE } = state['features/e2ee'];
19
+    const { e2eeSupported } = state['features/base/conference'];
20
+    const participantCount = getParticipantCount(state);
21
+
22
+    if (typeof everyoneSupportE2EE === 'undefined' && participantCount === 1) {
23
+        // This will happen if we are alone.
24
+
25
+        return e2eeSupported;
26
+    }
27
+
28
+    return everyoneSupportE2EE;
29
+}

読み込み中…
キャンセル
保存