Implement default welcome page and allow custom URL /w config

This changes the default behaviour of displaying the room directory to instead displaying the default homepage. If specified, the config "welcomePageUrl" can be used to override the default '/home.html'.
pull/21833/head
Luke Barnard 2017-05-24 17:55:36 +01:00
parent 867f8914e1
commit 5f36f797da
2 changed files with 4 additions and 12 deletions

View File

@ -240,7 +240,8 @@ export default React.createClass({
collapsedRhs={this.props.collapse_rhs} collapsedRhs={this.props.collapse_rhs}
teamServerUrl={this.props.config.teamServerConfig.teamServerURL} teamServerUrl={this.props.config.teamServerConfig.teamServerURL}
teamToken={this.props.teamToken} teamToken={this.props.teamToken}
/> homePageUrl={this.props.config.welcomePageUrl}
/>;
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/> if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.sideOpacity}/>
break; break;
@ -276,7 +277,6 @@ export default React.createClass({
selectedRoom={this.props.currentRoomId} selectedRoom={this.props.currentRoomId}
collapsed={this.props.collapse_lhs || false} collapsed={this.props.collapse_lhs || false}
opacity={this.props.sideOpacity} opacity={this.props.sideOpacity}
teamToken={this.props.teamToken}
/> />
<main className='mx_MatrixChat_middlePanel'> <main className='mx_MatrixChat_middlePanel'>
{page_element} {page_element}

View File

@ -457,10 +457,6 @@ module.exports = React.createClass({
this.notifyNewScreen('directory'); this.notifyNewScreen('directory');
break; break;
case 'view_home_page': case 'view_home_page':
if (!this._teamToken) {
dis.dispatch({action: 'view_room_directory'});
return;
}
this._setPage(PageTypes.HomePage); this._setPage(PageTypes.HomePage);
this.notifyNewScreen('home'); this.notifyNewScreen('home');
break; break;
@ -812,7 +808,7 @@ module.exports = React.createClass({
return; return;
} }
// The user has just logged in after registering // The user has just logged in after registering
dis.dispatch({action: 'view_room_directory'}); dis.dispatch({action: 'view_home_page'});
} else { } else {
this._showScreenAfterLogin(); this._showScreenAfterLogin();
} }
@ -834,12 +830,8 @@ module.exports = React.createClass({
action: 'view_room', action: 'view_room',
room_id: localStorage.getItem('mx_last_room_id'), room_id: localStorage.getItem('mx_last_room_id'),
}); });
} else if (this._teamToken) {
// Team token might be set if we're a guest.
// Guests do not call _onLoggedIn with a teamToken
dis.dispatch({action: 'view_home_page'});
} else { } else {
dis.dispatch({action: 'view_room_directory'}); dis.dispatch({action: 'view_home_page'});
} }
}, },