From e5e355ed2d2140f72c54eb0ba351c918b54d1cc3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 14 Feb 2019 12:35:09 +0000 Subject: [PATCH] Remove the white screen of welcome If there's no home page configured, view the first room. --- src/components/structures/LoggedInView.js | 13 ++-------- src/components/structures/MatrixChat.js | 7 ++++- src/utils/pages.js | 31 +++++++++++++++++++++++ 3 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 src/utils/pages.js diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 2303083d98..2e1b91fe0e 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -31,6 +31,7 @@ import sessionStore from '../../stores/SessionStore'; import MatrixClientPeg from '../../MatrixClientPeg'; import SettingsStore from "../../settings/SettingsStore"; import RoomListStore from "../../stores/RoomListStore"; +import { getHomePageUrl } from '../../utils/pages'; import TagOrderActions from '../../actions/TagOrderActions'; import RoomListActions from '../../actions/RoomListActions'; @@ -459,17 +460,7 @@ const LoggedInView = React.createClass({ case PageTypes.HomePage: { - const pagesConfig = this.props.config.embeddedPages; - let pageUrl = null; - if (pagesConfig) { - 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 - // page, which is not the same). - pageUrl = this.props.config.welcomePageUrl; - } + const pageUrl = getHomePageUrl(this.props.config); pageElement = { + dis.dispatch({action: 'view_next_room'}); + }); } } }, diff --git a/src/utils/pages.js b/src/utils/pages.js new file mode 100644 index 0000000000..d63ca3f2c7 --- /dev/null +++ b/src/utils/pages.js @@ -0,0 +1,31 @@ +/* +Copyright 2019 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +export function getHomePageUrl(appConfig) { + const pagesConfig = appConfig.embeddedPages; + let pageUrl = null; + if (pagesConfig) { + 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 + // page, which is not the same). + pageUrl = appConfig.welcomePageUrl; + } + + return pageUrl; +}