Refresh group rooms and members when selecting a tag
This commit is contained in:
parent
4d8394954c
commit
56ec7713bb
2 changed files with 20 additions and 0 deletions
|
@ -24,6 +24,7 @@ import { isOnlyCtrlOrCmdIgnoreShiftKeyEvent } from '../../../Keyboard';
|
||||||
import ContextualMenu from '../../structures/ContextualMenu';
|
import ContextualMenu from '../../structures/ContextualMenu';
|
||||||
|
|
||||||
import FlairStore from '../../../stores/FlairStore';
|
import FlairStore from '../../../stores/FlairStore';
|
||||||
|
import GroupStore from '../../../stores/GroupStore';
|
||||||
|
|
||||||
// A class for a child of TagPanel (possibly wrapped in a DNDTagTile) that represents
|
// A class for a child of TagPanel (possibly wrapped in a DNDTagTile) that represents
|
||||||
// a thing to click on for the user to filter the visible rooms in the RoomList to:
|
// a thing to click on for the user to filter the visible rooms in the RoomList to:
|
||||||
|
@ -57,6 +58,8 @@ export default React.createClass({
|
||||||
if (this.props.tag[0] === '+') {
|
if (this.props.tag[0] === '+') {
|
||||||
FlairStore.addListener('updateGroupProfile', this._onFlairStoreUpdated);
|
FlairStore.addListener('updateGroupProfile', this._onFlairStoreUpdated);
|
||||||
this._onFlairStoreUpdated();
|
this._onFlairStoreUpdated();
|
||||||
|
// New rooms or members may have been added to the group, fetch async
|
||||||
|
this._refreshGroup(this.props.tag);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -80,6 +83,11 @@ export default React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_refreshGroup(groupId) {
|
||||||
|
GroupStore.refreshGroupRooms(groupId);
|
||||||
|
GroupStore.refreshGroupMembers(groupId);
|
||||||
|
},
|
||||||
|
|
||||||
onClick: function(e) {
|
onClick: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -89,6 +97,10 @@ export default React.createClass({
|
||||||
ctrlOrCmdKey: isOnlyCtrlOrCmdIgnoreShiftKeyEvent(e),
|
ctrlOrCmdKey: isOnlyCtrlOrCmdIgnoreShiftKeyEvent(e),
|
||||||
shiftKey: e.shiftKey,
|
shiftKey: e.shiftKey,
|
||||||
});
|
});
|
||||||
|
if (this.props.tag[0] === '+') {
|
||||||
|
// New rooms or members may have been added to the group, fetch async
|
||||||
|
this._refreshGroup(this.props.tag);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onContextButtonClick: function(e) {
|
onContextButtonClick: function(e) {
|
||||||
|
|
|
@ -233,6 +233,14 @@ class GroupStore extends EventEmitter {
|
||||||
(this._state[this.STATE_KEY.Summary][groupId] || {}).user.is_privileged : null;
|
(this._state[this.STATE_KEY.Summary][groupId] || {}).user.is_privileged : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshGroupRooms(groupId) {
|
||||||
|
return this._fetchResource(this.STATE_KEY.GroupRooms, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshGroupMembers(groupId) {
|
||||||
|
return this._fetchResource(this.STATE_KEY.GroupMembers, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
addRoomToGroup(groupId, roomId, isPublic) {
|
addRoomToGroup(groupId, roomId, isPublic) {
|
||||||
return MatrixClientPeg.get()
|
return MatrixClientPeg.get()
|
||||||
.addRoomToGroup(groupId, roomId, isPublic)
|
.addRoomToGroup(groupId, roomId, isPublic)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue