Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(e2ee) fix showing not supported warning when alone

Saúl Ibarra Corretgéddbf334930e8
diff --git a/react/features/e2ee/components/E2EESection.js b/react/features/e2ee/components/E2EESection.js
index 58077bacb7..66bf0a76aa 100644
--- a/react/features/e2ee/components/E2EESection.js
+++ b/react/features/e2ee/components/E2EESection.js
@@ -8,7 +8,7 @@ import { translate } from '../../base/i18n';
import { Switch } from '../../base/react';
import { connect } from '../../base/redux';
import { toggleE2EE } from '../actions';
-
+import { doesEveryoneSupportE2EE } from '../functions';
type Props = {
@@ -38,12 +38,7 @@ type State = {
/**
* True if the switch is toggled on.
*/
- enabled: boolean,
-
- /**
- * True if the section description should be expanded, false otherwise.
- */
- expand: boolean
+ enabled: boolean
};
/**
@@ -147,11 +142,11 @@ class E2EESection extends Component<Props, State> {
* @returns {Props}
*/
function mapStateToProps(state) {
- const { enabled, everyoneSupportE2EE } = state['features/e2ee'];
+ const { enabled } = state['features/e2ee'];
return {
_enabled: enabled,
- _everyoneSupportE2EE: everyoneSupportE2EE
+ _everyoneSupportE2EE: doesEveryoneSupportE2EE(state)
};
}
diff --git a/react/features/e2ee/functions.js b/react/features/e2ee/functions.js
new file mode 100644
index 0000000000..03eb975c22
--- /dev/null
+++ b/react/features/e2ee/functions.js
@@ -0,0 +1,29 @@
+
+import { getParticipantCount } from '../base/participants/functions';
+import { toState } from '../base/redux';
+
+/**
+ * Gets the value of a specific React {@code Component} prop of the currently
+ * mounted {@link App}.
+ *
+ * @param {Function|Object} stateful - The redux store or {@code getState}
+ * function.
+ * @param {string} propName - The name of the React {@code Component} prop of
+ * the currently mounted {@code App} to get.
+ * @returns {*} The value of the specified React {@code Component} prop of the
+ * currently mounted {@code App}.
+ */
+export function doesEveryoneSupportE2EE(stateful) {
+ const state = toState(stateful);
+ const { everyoneSupportE2EE } = state['features/e2ee'];
+ const { e2eeSupported } = state['features/base/conference'];
+ const participantCount = getParticipantCount(state);
+
+ if (typeof everyoneSupportE2EE === 'undefined' && participantCount === 1) {
+ // This will happen if we are alone.
+
+ return e2eeSupported;
+ }
+
+ return everyoneSupportE2EE;
+}