1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

move the fact that we're prototyping only with joined members up the stack to client

only MatrixClient really needs to know that for now we only load joined members, the rest of the code can be generic for other membership types as that is the eventual plan, to also support invites at least.
This commit is contained in:
Bruno Windels
2018-07-19 15:21:51 +02:00
parent d95d44dc94
commit 5de0d39553
6 changed files with 45 additions and 33 deletions

View File

@@ -767,7 +767,18 @@ MatrixClient.prototype.loadRoomMembersIfNeeded = async function(roomId) {
if (!room || !room.membersNeedLoading()) {
return;
}
const membersPromise = this.joinedMembers(roomId);
const joinedMembersPromise = this.joinedMembers(roomId);
const membersPromise = joinedMembersPromise.then((profiles) => {
return Object.entries(profiles).map(([userId, profile]) => {
return {
userId: userId,
avatarUrl: profile.avatar_url,
displayName: profile.display_name,
membership: "join", // as we need to support invitees as well
// in the future, already include but hardcode it
};
});
});
await room.setLazilyLoadedMembers(membersPromise);
};