matrix-org / matrix-org/matrix-js-sdk
room.getJoinedMembers always returns zero room members
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
I just need to be able to query room members at an arbitrary time (rather than via an event.)
matrixClient.joinRoom(roomId).done(function(room) {
console.log("joined room");
var memberList = room.getJoinedMembers();
console.log("there are %s people in the room.", memberList.length);
for (var i = 0; i < memberList.length; i++) {
console.log(
"(%s) %s",
memberList[i].membership,
memberList[i].name
);
}
});
Always returns zero people in the room, when I know there are several. I have also tried room.currentState.getMembers() and getLiveTimeline().getState('b').getMembers(), same problem.
The only way I can successfully get a list of room members is using the sample code, for when room state changes.
Am I doing this wrong?
tested on 0.8.5 and 0.9.0.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report names room.getJoinedMembers(), room.currentState.getMembers(), and getLiveTimeline().getState('b').getMembers(); start by reproducing the behavior after joinRoom(roomId) on the referenced SDK versions. Done means the appropriate member query returns existing joined members, not only updates received from later state changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100