Fix start_sso not working with guests disabled (#10720)

* Fix start_sso not working with guests disabled

* Remove confusing prop
This commit is contained in:
Michael Telatynski 2023-04-28 11:16:07 +01:00 committed by GitHub
parent 4c72cceb70
commit 0d1020c66f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -161,7 +161,6 @@ interface IScreen {
interface IProps {
config: IConfigOptions;
serverConfig?: ValidatedServerConfig;
onNewScreen: (screen: string, replaceLast: boolean) => void;
enableGuest?: boolean;
// the queryParams extracted from the [real] query-string of the URI
@ -474,15 +473,13 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
}, 1000);
private getFallbackHsUrl(): string | undefined {
if (this.props.serverConfig?.isDefault) {
if (this.getServerProperties().serverConfig?.isDefault) {
return this.props.config.fallback_hs_url;
}
}
private getServerProperties(): { serverConfig: ValidatedServerConfig } {
let props = this.state.serverConfig;
if (!props) props = this.props.serverConfig; // for unit tests
if (!props) props = SdkConfig.get("validated_server_config")!;
const props = this.state.serverConfig || SdkConfig.get("validated_server_config")!;
return { serverConfig: props };
}
@ -1776,7 +1773,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
} else if (screen === "start_sso" || screen === "start_cas") {
let cli = MatrixClientPeg.get();
if (!cli) {
const { hsUrl, isUrl } = this.props.serverConfig;
const { hsUrl, isUrl } = this.getServerProperties().serverConfig;
cli = createClient({
baseUrl: hsUrl,
idBaseUrl: isUrl,