mirror of https://github.com/vector-im/riot-web
Revert "At /user, view member of current room"
parent
02217c8bd2
commit
d9e8292a5e
|
@ -301,13 +301,13 @@ export default React.createClass({
|
||||||
|
|
||||||
case PageTypes.UserView:
|
case PageTypes.UserView:
|
||||||
page_element = null; // deliberately null for now
|
page_element = null; // deliberately null for now
|
||||||
right_panel = <RightPanel opacity={this.props.rightOpacity} />;
|
right_panel = <RightPanel userId={this.props.viewUserId} opacity={this.props.rightOpacity} />;
|
||||||
break;
|
break;
|
||||||
case PageTypes.GroupView:
|
case PageTypes.GroupView:
|
||||||
page_element = <GroupView
|
page_element = <GroupView
|
||||||
groupId={this.props.currentGroupId}
|
groupId={this.props.currentGroupId}
|
||||||
/>;
|
/>;
|
||||||
//right_panel = <RightPanel opacity={this.props.rightOpacity} />;
|
//right_panel = <RightPanel userId={this.props.viewUserId} opacity={this.props.rightOpacity} />;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -448,7 +448,6 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
this.notifyNewScreen('user/' + payload.member.userId);
|
|
||||||
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
|
||||||
|
@ -1204,44 +1203,21 @@ module.exports = React.createClass({
|
||||||
} else if (screen.indexOf('user/') == 0) {
|
} else if (screen.indexOf('user/') == 0) {
|
||||||
const userId = screen.substring(5);
|
const userId = screen.substring(5);
|
||||||
|
|
||||||
// Wait for the first sync so that `getRoom` gives us a room object if it's
|
if (params.action === 'chat') {
|
||||||
// in the sync response
|
this._chatCreateOrReuse(userId);
|
||||||
const waitFor = this.firstSyncPromise ?
|
return;
|
||||||
this.firstSyncPromise.promise : Promise.resolve();
|
}
|
||||||
waitFor.then(() => {
|
|
||||||
if (params.action === 'chat') {
|
|
||||||
this._chatCreateOrReuse(userId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the member object for the current room, if a current room is set or
|
this.setState({ viewUserId: userId });
|
||||||
// we have a last_room in localStorage. The user might not be a member of
|
this._setPage(PageTypes.UserView);
|
||||||
// this room (in which case member will be falsey).
|
this.notifyNewScreen('user/' + userId);
|
||||||
let member;
|
const member = new Matrix.RoomMember(null, userId);
|
||||||
const roomId = this.state.currentRoomId || localStorage.getItem('mx_last_room_id');
|
if (member) {
|
||||||
if (roomId) {
|
|
||||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
|
||||||
if (room) {
|
|
||||||
member = room.getMember(userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (member) {
|
|
||||||
// This user is a member of this room, so view the room
|
|
||||||
dis.dispatch({
|
|
||||||
action: 'view_room',
|
|
||||||
room_id: roomId,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// This user is not a member of this room, show the user view
|
|
||||||
member = new Matrix.RoomMember(null, userId);
|
|
||||||
this._setPage(PageTypes.UserView);
|
|
||||||
}
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_user',
|
action: 'view_user',
|
||||||
member: member,
|
member: member,
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
} else if (screen.indexOf('group/') == 0) {
|
} else if (screen.indexOf('group/') == 0) {
|
||||||
const groupId = screen.substring(6);
|
const groupId = screen.substring(6);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue