You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The MXRoom members() returns an incomplete list of the members in the room.
The bug seems to be that it incorrectly thinks that its timeline has already cached the complete list of members. It returns the list of members from the timeline without querying the homeserver.
For example:
2021-08-18 10:48:59.336539-0500 Circles[21413:991558] [MXRoom] members: roomId: !sTCABYwgCcBxUpcZkb:kombucha.social
2021-08-18 10:48:59.336743-0500 Circles[21413:991558] [MXRoom] members: All members are known. Return 3 joined, 0 invited
But when I query the same room directly using MXRestClient membersOfRoom: withParameters: I see 7 members in state join and one member in state leave.
To Reproduce
Create a room
Join several users into the room, but have only 1 or 2 send messages
Query with MXRoom.members
Query with MXRestClient.membersOfRoom
Compare the two lists of users
Code that I'm using to query the MXRoom:
mxroom.members{ response in
switch response {case.failure(let err):letmsg="Failed to get members: \(err)"print("ASYNCMEMBERS\t\(msg)")completion(.failure(KSError(message: msg)))case.success(let maybeMxMembers):print("ASYNCMEMBERS\tGot response from Matrix")
if let members = maybeMxMembers {print("ASYNCMEMBERS\tMatrix returned \(members.members.count) members in room \(self.id)")self.mxMembers = members
self.objectWillChange.send()letusers= members.joinedMembers.compactMap{ mxroommember inself.matrix.getUser(userId: mxroommember.userId)}completion(.success(users))}else{completion(.failure(KSError(message:"Matrix returned no members for room \(self.id)")))}}}
Code that I'm using to query the MXRestClient:
//let params = [kMXMembersOfRoomParametersMembership: "join"]letparams=[String:Any]()
restClient.members(ofRoom: roomId,
withParameters: params,
success:{ result in
guard let events = result as?[MXEvent]else{print("MATRIXMEMBERS\tRest client gave us garbage")return}print("MATRIXMEMBERS\tGot \(events.count) state events from Matrix")letusers:[MatrixUser]= events.compactMap{ event in
guard let userId = event.stateKey,let userState = event.content["membership"]else{print("MATRIXMEMBERS\tGot an event without valid membership info")returnnil}print("MATRIXMEMBERS\tGot an event for user [\(userId)]")print("MATRIXMEMBERS\t\(roomId)\t\(userId)\t\(userState)")returnself.getUser(userId: userId)}completion(.success(users))},
failure:{ error inletmsg="Failed to get room members from the homeserver"print("MATRIXMEMBERS\t\(msg)")leterr=KSError(message: msg)completion(.failure(err))})
Expected behavior
The function should return the full list of current members in the room.
Additional context
The room in question is basically a social media "wall" room in Circles, where typically only the owner posts messages.
Maybe the algorithm here fails when there are silent users who have not sent any messages into the room???
The 4 users who are missed by MXRoom.members have never sent any messages into the room.
At least one (maybe two?) of the users who are picked up by MXRoom.members have also never sent any m.room.messages. It's possible that they have sent other events, like possibly an m.room.member event to set a new avatar image.
The text was updated successfully, but these errors were encountered:
Describe the bug
The MXRoom
members()
returns an incomplete list of the members in the room.The bug seems to be that it incorrectly thinks that its timeline has already cached the complete list of members. It returns the list of members from the timeline without querying the homeserver.
For example:
But when I query the same room directly using
MXRestClient membersOfRoom: withParameters:
I see 7 members in statejoin
and one member in stateleave
.To Reproduce
MXRoom.members
MXRestClient.membersOfRoom
Code that I'm using to query the MXRoom:
Code that I'm using to query the MXRestClient:
Expected behavior
The function should return the full list of current members in the room.
Additional context
The room in question is basically a social media "wall" room in Circles, where typically only the owner posts messages.
Maybe the algorithm here fails when there are silent users who have not sent any messages into the room???
MXRoom.members
have never sent any messages into the room.MXRoom.members
have also never sent anym.room.message
s. It's possible that they have sent other events, like possibly anm.room.member
event to set a new avatar image.The text was updated successfully, but these errors were encountered: