Improve identifiers and code readability

This commit is contained in:
Michael Telatynski 2020-12-09 11:14:06 +00:00
parent e896b009f1
commit 5be65a525d
3 changed files with 16 additions and 7 deletions

View file

@ -49,10 +49,19 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
const config = SdkConfig.get();
this.defaultServer = config["validated_server_config"] as ValidatedServerConfig;
const { serverConfig } = this.props;
let otherHomeserver = "";
if (!serverConfig.isDefault) {
if (serverConfig.isNameResolvable && serverConfig.hsName) {
otherHomeserver = serverConfig.hsName;
} else {
otherHomeserver = serverConfig.hsUrl;
}
}
this.state = {
defaultChosen: serverConfig.isDefault,
otherHomeserver: serverConfig.isDefault ? ""
: (serverConfig.static ? serverConfig.hsUrl : serverConfig.hsName || serverConfig.hsUrl),
otherHomeserver,
};
}