Pārlūkot izejas kodu

fix(e2ee) fix showing not supported warning when alone

master
Saúl Ibarra Corretgé 4 gadus atpakaļ
vecāks
revīzija
ddbf334930

+ 4
- 9
react/features/e2ee/components/E2EESection.js Parādīt failu

8
 import { Switch } from '../../base/react';
8
 import { Switch } from '../../base/react';
9
 import { connect } from '../../base/redux';
9
 import { connect } from '../../base/redux';
10
 import { toggleE2EE } from '../actions';
10
 import { toggleE2EE } from '../actions';
11
-
11
+import { doesEveryoneSupportE2EE } from '../functions';
12
 
12
 
13
 type Props = {
13
 type Props = {
14
 
14
 
38
     /**
38
     /**
39
      * True if the switch is toggled on.
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
  * @returns {Props}
142
  * @returns {Props}
148
  */
143
  */
149
 function mapStateToProps(state) {
144
 function mapStateToProps(state) {
150
-    const { enabled, everyoneSupportE2EE } = state['features/e2ee'];
145
+    const { enabled } = state['features/e2ee'];
151
 
146
 
152
     return {
147
     return {
153
         _enabled: enabled,
148
         _enabled: enabled,
154
-        _everyoneSupportE2EE: everyoneSupportE2EE
149
+        _everyoneSupportE2EE: doesEveryoneSupportE2EE(state)
155
     };
150
     };
156
 }
151
 }
157
 
152
 

+ 29
- 0
react/features/e2ee/functions.js Parādīt failu

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
+}

Notiek ielāde…
Atcelt
Saglabāt