Skip to content

Commit

Permalink
Fix start_sso not working with guests disabled (#10720)
Browse files Browse the repository at this point in the history
* Fix start_sso not working with guests disabled

* Remove confusing prop
  • Loading branch information
t3chguy committed Apr 28, 2023
1 parent 4c72cce commit 0d1020c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 };
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0d1020c

Please sign in to comment.