mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
159343dd23
@ -100,6 +100,7 @@ module.exports = React.createClass({
|
|||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
const cli = this.context.matrixClient;
|
const cli = this.context.matrixClient;
|
||||||
cli.on("RoomState.members", this.onRoomStateMember);
|
cli.on("RoomState.members", this.onRoomStateMember);
|
||||||
|
this._initGroupStore(this.props.groupId);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
@ -107,20 +108,42 @@ module.exports = React.createClass({
|
|||||||
if (this.context.matrixClient) {
|
if (this.context.matrixClient) {
|
||||||
this.context.matrixClient.removeListener("RoomState.members", this.onRoomStateMember);
|
this.context.matrixClient.removeListener("RoomState.members", this.onRoomStateMember);
|
||||||
}
|
}
|
||||||
|
this._unregisterGroupStore();
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
if (this.props.groupId) {
|
return {
|
||||||
return {
|
phase: this.props.groupId ? this.Phase.GroupMemberList : this.Phase.RoomMemberList,
|
||||||
phase: this.Phase.GroupMemberList,
|
isUserPrivilegedInGroup: null,
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
phase: this.Phase.RoomMemberList,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentWillReceiveProps(newProps) {
|
||||||
|
if (newProps.groupId !== this.props.groupId) {
|
||||||
|
this._unregisterGroupStore();
|
||||||
|
this._initGroupStore(newProps.groupId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_initGroupStore(groupId) {
|
||||||
|
this._groupStore = GroupStoreCache.getGroupStore(
|
||||||
|
this.context.matrixClient, this.props.groupId,
|
||||||
|
);
|
||||||
|
this._groupStore.registerListener(this.onGroupStoreUpdated);
|
||||||
|
},
|
||||||
|
|
||||||
|
_unregisterGroupStore() {
|
||||||
|
if (this._groupStore) {
|
||||||
|
this._groupStore.unregisterListener(this.onGroupStoreUpdated);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onGroupStoreUpdated: function(){
|
||||||
|
this.setState({
|
||||||
|
isUserPrivilegedInGroup: this._groupStore.isUserPrivileged(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onCollapseClick: function() {
|
onCollapseClick: function() {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'hide_right_panel',
|
action: 'hide_right_panel',
|
||||||
@ -328,9 +351,7 @@ module.exports = React.createClass({
|
|||||||
panel = <div className="mx_RightPanel_blank"></div>;
|
panel = <div className="mx_RightPanel_blank"></div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.groupId &&
|
if (this.props.groupId && this.state.isUserPrivilegedInGroup) {
|
||||||
GroupStoreCache.getGroupStore(this.context.matrixClient, this.props.groupId).isUserPrivileged()
|
|
||||||
) {
|
|
||||||
inviteGroup = isPhaseGroup ? (
|
inviteGroup = isPhaseGroup ? (
|
||||||
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
|
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
|
||||||
<div className="mx_RightPanel_icon" >
|
<div className="mx_RightPanel_icon" >
|
||||||
|
Loading…
Reference in New Issue
Block a user