mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Bugfix: Accepting an invite no longer results in a stale membership list.
This commit is contained in:
parent
b8c18130da
commit
8b0db49b8b
@ -35,10 +35,12 @@ module.exports = {
|
|||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
cli.on("RoomState.members", this.onRoomStateMember);
|
cli.on("RoomState.members", this.onRoomStateMember);
|
||||||
|
cli.on("Room", this.onRoom); // invites
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
if (MatrixClientPeg.get()) {
|
if (MatrixClientPeg.get()) {
|
||||||
|
MatrixClientPeg.get().removeListener("Room", this.onRoom);
|
||||||
MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember);
|
MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember);
|
||||||
MatrixClientPeg.get().removeListener("User.presence", this.userPresenceFn);
|
MatrixClientPeg.get().removeListener("User.presence", this.userPresenceFn);
|
||||||
}
|
}
|
||||||
@ -69,7 +71,21 @@ module.exports = {
|
|||||||
/*componentWillReceiveProps: function(newProps) {
|
/*componentWillReceiveProps: function(newProps) {
|
||||||
},*/
|
},*/
|
||||||
|
|
||||||
|
onRoom: function(room) {
|
||||||
|
if (room.roomId !== this.props.roomId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// We listen for room events because when we accept an invite
|
||||||
|
// we need to wait till the room is fully populated with state
|
||||||
|
// before refreshing the member list else we get a stale list.
|
||||||
|
this._updateList();
|
||||||
|
},
|
||||||
|
|
||||||
onRoomStateMember: function(ev, state, member) {
|
onRoomStateMember: function(ev, state, member) {
|
||||||
|
this._updateList();
|
||||||
|
},
|
||||||
|
|
||||||
|
_updateList: function() {
|
||||||
var members = this.roomMembers();
|
var members = this.roomMembers();
|
||||||
this.setState({
|
this.setState({
|
||||||
memberDict: members
|
memberDict: members
|
||||||
|
Loading…
Reference in New Issue
Block a user