Don't use _matrix as default if there isn't one

This commit is contained in:
David Baker 2016-09-28 10:58:01 +01:00
parent b2dd3ecf3a
commit a32abae5a3

View File

@ -18,8 +18,8 @@ import React from 'react';
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
export default class NetworkDropdown extends React.Component { export default class NetworkDropdown extends React.Component {
constructor() { constructor(props) {
super(); super(props);
this.dropdownRootElement = null; this.dropdownRootElement = null;
this.ignoreEvent = null; this.ignoreEvent = null;
@ -34,10 +34,20 @@ export default class NetworkDropdown extends React.Component {
this.inputTextBox = null; this.inputTextBox = null;
let defaultNetwork = null;
if (
this.props.config.serverConfig &&
this.props.config.serverConfig[server] &&
this.props.config.serverConfig[server].networks &&
'_matrix' in this.props.config.serverConfig[server].networks
) {
defaultNetwork = '_matrix';
}
this.state = { this.state = {
expanded: false, expanded: false,
selectedServer: MatrixClientPeg.getHomeServerName(), selectedServer: MatrixClientPeg.getHomeServerName(),
selectedNetwork: '_matrix', selectedNetwork: defaultNetwork,
}; };
} }