Merge pull request #2611 from matrix-org/jryans/welcome-page-cleanup
Welcome page cleanup
This commit is contained in:
commit
fbc1779b21
3 changed files with 32 additions and 18 deletions
|
@ -574,11 +574,8 @@ export default React.createClass({
|
||||||
const UserSettingsDialog = sdk.getComponent("dialogs.UserSettingsDialog");
|
const UserSettingsDialog = sdk.getComponent("dialogs.UserSettingsDialog");
|
||||||
Modal.createTrackedDialog('User settings', '', UserSettingsDialog, {}, 'mx_SettingsDialog');
|
Modal.createTrackedDialog('User settings', '', UserSettingsDialog, {}, 'mx_SettingsDialog');
|
||||||
|
|
||||||
// View the home page if we need something to look at
|
// View the welcome or home page if we need something to look at
|
||||||
if (!this.state.currentGroupId && !this.state.currentRoomId) {
|
this._viewSomethingBehindModal();
|
||||||
this._setPage(PageTypes.HomePage);
|
|
||||||
this.notifyNewScreen('home');
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'view_create_room':
|
case 'view_create_room':
|
||||||
|
@ -595,11 +592,8 @@ export default React.createClass({
|
||||||
config: this.props.config,
|
config: this.props.config,
|
||||||
}, 'mx_RoomDirectory_dialogWrapper');
|
}, 'mx_RoomDirectory_dialogWrapper');
|
||||||
|
|
||||||
// View the home page if we need something to look at
|
// View the welcome or home page if we need something to look at
|
||||||
if (!this.state.currentGroupId && !this.state.currentRoomId) {
|
this._viewSomethingBehindModal();
|
||||||
this._setPage(PageTypes.HomePage);
|
|
||||||
this.notifyNewScreen('home');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'view_my_groups':
|
case 'view_my_groups':
|
||||||
|
@ -825,6 +819,7 @@ export default React.createClass({
|
||||||
this.focusComposer = true;
|
this.focusComposer = true;
|
||||||
|
|
||||||
const newState = {
|
const newState = {
|
||||||
|
view: VIEWS.LOGGED_IN,
|
||||||
currentRoomId: roomInfo.room_id || null,
|
currentRoomId: roomInfo.room_id || null,
|
||||||
page_type: PageTypes.RoomView,
|
page_type: PageTypes.RoomView,
|
||||||
thirdPartyInvite: roomInfo.third_party_invite,
|
thirdPartyInvite: roomInfo.third_party_invite,
|
||||||
|
@ -887,6 +882,16 @@ export default React.createClass({
|
||||||
this.notifyNewScreen('group/' + groupId);
|
this.notifyNewScreen('group/' + groupId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_viewSomethingBehindModal() {
|
||||||
|
if (this.state.view !== VIEWS.LOGGED_IN) {
|
||||||
|
this._viewWelcome();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.state.currentGroupId && !this.state.currentRoomId) {
|
||||||
|
this._viewHome();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_viewWelcome() {
|
_viewWelcome() {
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
view: VIEWS.WELCOME,
|
view: VIEWS.WELCOME,
|
||||||
|
@ -1552,11 +1557,7 @@ export default React.createClass({
|
||||||
payload.room_id = roomString;
|
payload.room_id = roomString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we can't view a room unless we're logged in
|
dis.dispatch(payload);
|
||||||
// (a guest account is fine)
|
|
||||||
if (this.state.view === VIEWS.LOGGED_IN) {
|
|
||||||
dis.dispatch(payload);
|
|
||||||
}
|
|
||||||
} else if (screen.indexOf('user/') == 0) {
|
} else if (screen.indexOf('user/') == 0) {
|
||||||
const userId = screen.substring(5);
|
const userId = screen.substring(5);
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,11 @@ module.exports = React.createClass({
|
||||||
this.protocols = null;
|
this.protocols = null;
|
||||||
|
|
||||||
this.setState({protocolsLoading: true});
|
this.setState({protocolsLoading: true});
|
||||||
|
if (!MatrixClientPeg.get()) {
|
||||||
|
// We may not have a client yet when invoked from welcome page
|
||||||
|
this.setState({protocolsLoading: false});
|
||||||
|
return;
|
||||||
|
}
|
||||||
MatrixClientPeg.get().getThirdpartyProtocols().done((response) => {
|
MatrixClientPeg.get().getThirdpartyProtocols().done((response) => {
|
||||||
this.protocols = response;
|
this.protocols = response;
|
||||||
this.setState({protocolsLoading: false});
|
this.setState({protocolsLoading: false});
|
||||||
|
|
|
@ -283,6 +283,15 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getRoomId() {
|
||||||
|
// According to `_onRoomViewStoreUpdate`, `state.roomId` can be null
|
||||||
|
// if we have a room alias we haven't resolved yet. To work around this,
|
||||||
|
// first we'll try the room object if it's there, and then fallback to
|
||||||
|
// the bare room ID. (We may want to update `state.roomId` after
|
||||||
|
// resolving aliases, so we could always trust it.)
|
||||||
|
return this.state.room ? this.state.room.roomId : this.state.roomId;
|
||||||
|
},
|
||||||
|
|
||||||
_onWidgetEchoStoreUpdate: function() {
|
_onWidgetEchoStoreUpdate: function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
showApps: this._shouldShowApps(this.state.room),
|
showApps: this._shouldShowApps(this.state.room),
|
||||||
|
@ -877,13 +886,12 @@ module.exports = React.createClass({
|
||||||
// If the user is a ROU, allow them to transition to a PWLU
|
// If the user is a ROU, allow them to transition to a PWLU
|
||||||
if (cli && cli.isGuest()) {
|
if (cli && cli.isGuest()) {
|
||||||
// Join this room once the user has registered and logged in
|
// Join this room once the user has registered and logged in
|
||||||
const signUrl = this.props.thirdPartyInvite ?
|
// (If we failed to peek, we may not have a valid room object.)
|
||||||
this.props.thirdPartyInvite.inviteSignUrl : undefined;
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'do_after_sync_prepared',
|
action: 'do_after_sync_prepared',
|
||||||
deferred_action: {
|
deferred_action: {
|
||||||
action: 'view_room',
|
action: 'view_room',
|
||||||
room_id: this.state.room.roomId,
|
room_id: this._getRoomId(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue