From 0d1020c66f25ec7a3df641f64cee736fcf0fe7f8 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 28 Apr 2023 11:16:07 +0100 Subject: [PATCH] Fix start_sso not working with guests disabled (#10720) * Fix start_sso not working with guests disabled * Remove confusing prop --- src/components/structures/MatrixChat.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index d614a5edf3f..7cfe1c213c2 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -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 { }, 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 { } 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,