Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix start_sso not working with guests disabled #10720

Merged
merged 2 commits into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -472,15 +471,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 @@ -1774,7 +1771,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