1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00

Sync room state when joining via client.joinRoom

Does not currently sync state when another device joins.
Update node example app to refresh room list.
This commit is contained in:
Kegan Dougal
2015-06-22 17:50:49 +01:00
parent ad70b3d434
commit bc0e2ad504
4 changed files with 126 additions and 44 deletions

View File

@@ -55,6 +55,18 @@ utils.inherits(Room, EventEmitter);
});
};
/**
* Check if the given user_id has the given membership state.
* @param {string} userId The user ID to check.
* @param {string} membership The membership e.g. <code>'join'</code>
* @return {boolean} True if this user_id has the given membership state.
*/
Room.prototype.hasMembershipState = function(userId, membership) {
return utils.filter(this.currentState.getMembers(), function(m) {
return m.membership === membership && m.userId === userId;
}).length > 0;
};
/**
* Add some events to this room's timeline. Will fire "Room.timeline" for
* each event added.