Add group member right panel

This commit is contained in:
David Baker 2017-08-09 15:36:51 +01:00
parent 12628b67ea
commit 7c4b6739fc

View file

@ -42,6 +42,7 @@ module.exports = React.createClass({
FilePanel: 'FilePanel',
NotificationPanel: 'NotificationPanel',
RoomMemberInfo: 'RoomMemberInfo',
GroupMemberInfo: 'GroupMemberInfo',
},
componentWillMount: function() {
@ -57,6 +58,10 @@ module.exports = React.createClass({
}
},
componentWillReceiveProps: function(newprops) {
this.setState(this.getInitialState());
},
getInitialState: function() {
if (this.props.userId) {
const member = new Matrix.RoomMember(null, this.props.userId);
@ -142,12 +147,19 @@ module.exports = React.createClass({
});
} else if (this.props.groupId) {
this.setState({
phase: this.Phase.GroupMemberList
phase: this.Phase.GroupMemberList,
groupId: payload.groupId,
member: payload.member,
});
}
}
}
else if (payload.action === "view_room") {
} else if (payload.action === "view_group_user") {
this.setState({
phase: this.Phase.GroupMemberInfo,
groupId: payload.groupId,
member: payload.member,
});
} else if (payload.action === "view_room") {
if (this.state.phase === this.Phase.RoomMemberInfo) {
this.setState({
phase: this.Phase.RoomMemberList
@ -242,6 +254,9 @@ module.exports = React.createClass({
} else if (this.state.phase == this.Phase.RoomMemberInfo) {
const MemberInfo = sdk.getComponent('rooms.MemberInfo');
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.props.userId} />
} else if (this.state.phase == this.Phase.GroupMemberInfo) {
const GroupMemberInfo = sdk.getComponent('groups.GroupMemberInfo');
panel = <GroupMemberInfo member={this.state.member} groupId={this.props.groupId} key={this.state.member.user_id} />
} else if (this.state.phase == this.Phase.NotificationPanel) {
panel = <NotificationPanel />
} else if (this.state.phase == this.Phase.FilePanel) {