dispatch for user screen

pull/21833/head
Bruno Windels 2019-04-17 18:26:07 +02:00
parent d5cc835a93
commit 190143ca6c
1 changed files with 8 additions and 4 deletions

View File

@ -566,7 +566,7 @@ export default React.createClass({
}); });
break; break;
case 'view_user_info': case 'view_user_info':
this._viewUser(payload.userId); this._viewUser(payload.userId, payload.subAction);
break; break;
case 'view_room': case 'view_room':
// Takes either a room ID or room alias: if switching to a room the client is already // Takes either a room ID or room alias: if switching to a room the client is already
@ -922,13 +922,13 @@ export default React.createClass({
this.notifyNewScreen('home'); this.notifyNewScreen('home');
}, },
_viewUser: function(userId, action) { _viewUser: function(userId, subAction) {
// Wait for the first sync so that `getRoom` gives us a room object if it's // Wait for the first sync so that `getRoom` gives us a room object if it's
// in the sync response // in the sync response
const waitForSync = this.firstSyncPromise ? const waitForSync = this.firstSyncPromise ?
this.firstSyncPromise.promise : Promise.resolve(); this.firstSyncPromise.promise : Promise.resolve();
waitForSync.then(() => { waitForSync.then(() => {
if (action === 'chat') { if (subAction === 'chat') {
this._chatCreateOrReuse(userId); this._chatCreateOrReuse(userId);
return; return;
} }
@ -1631,7 +1631,11 @@ export default React.createClass({
dis.dispatch(payload); 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);
this._viewUser(userId, params.action); dis.dispatch({
action: 'view_user_info',
userId: userId,
subAction: params.action,
});
} else if (screen.indexOf('group/') == 0) { } else if (screen.indexOf('group/') == 0) {
const groupId = screen.substring(6); const groupId = screen.substring(6);