fix(e2ee) fix showing not supported warning when alone
This commit is contained in:
parent
cd5f2b483f
commit
ddbf334930
|
@ -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)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue