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