Merge pull request #5658 from matrix-org/travis/welcome-login

Add an optional config option to make the welcome page the login page
This commit is contained in:
Travis Ralston 2021-03-19 09:12:35 -06:00 committed by GitHub
commit 3caf07be87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 21 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2019 New Vector Ltd
Copyright 2019, 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export function getHomePageUrl(appConfig) {
import { ConfigOptions } from "../SdkConfig";
export function getHomePageUrl(appConfig: ConfigOptions): string | null {
const pagesConfig = appConfig.embeddedPages;
let pageUrl = null;
if (pagesConfig) {
pageUrl = pagesConfig.homeUrl;
}
let pageUrl = pagesConfig?.homeUrl;
if (!pageUrl) {
// This is a deprecated config option for the home page
// (despite the name, given we also now have a welcome
@ -29,3 +29,8 @@ export function getHomePageUrl(appConfig) {
return pageUrl;
}
export function shouldUseLoginForWelcome(appConfig: ConfigOptions): boolean {
const pagesConfig = appConfig.embeddedPages;
return pagesConfig?.loginForWelcome === true;
}