From 36a608952db512c70a289a731f68034115c39f65 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 28 Aug 2016 14:04:25 +0100 Subject: [PATCH] make /user URLs work --- src/components/structures/RightPanel.js | 34 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index ca9376e1..4ca3dded 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -17,7 +17,8 @@ limitations under the License. 'use strict'; var React = require('react'); -var sdk = require('matrix-react-sdk') +var sdk = require('matrix-react-sdk'); +var Matrix = require("matrix-js-sdk"); var dis = require('matrix-react-sdk/lib/dispatcher'); var MatrixClientPeg = require("matrix-react-sdk/lib/MatrixClientPeg"); var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc'); @@ -45,8 +46,17 @@ module.exports = React.createClass({ }, getInitialState: function() { - return { - phase : this.Phase.MemberList + if (this.props.userId) { + var member = new Matrix.RoomMember(null, this.props.userId); + return { + phase: this.Phase.MemberInfo, + member: member, + } + } + else { + return { + phase: this.Phase.MemberList + } } }, @@ -97,7 +107,7 @@ module.exports = React.createClass({ }); } } - if (payload.action === "view_room") { + else if (payload.action === "view_room") { if (this.state.phase === this.Phase.MemberInfo) { this.setState({ phase: this.Phase.MemberList @@ -145,15 +155,15 @@ module.exports = React.createClass({ { filesHighlight } ; + } - if (!this.props.collapsed) { - if(this.state.phase == this.Phase.MemberList) { - panel = - } - else if(this.state.phase == this.Phase.MemberInfo) { - var MemberInfo = sdk.getComponent('rooms.MemberInfo'); - panel = - } + if (!this.props.collapsed) { + if(this.props.roomId && this.state.phase == this.Phase.MemberList) { + panel = + } + else if(this.state.phase == this.Phase.MemberInfo) { + var MemberInfo = sdk.getComponent('rooms.MemberInfo'); + panel = } }