From f8140866ae39b5f67dcf52653b0092da1bdecc6c Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 7 Nov 2022 08:41:15 +0100 Subject: [PATCH] fix: Do not request users in not joined rooms --- lib/src/room.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 0ed156ce..18dc4cd1 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1458,9 +1458,16 @@ class Room { setState(user); } } - if (_requestedParticipants || participantListComplete) { + + // Do not request users from the server if we have already done it + // in this session, have a complete list locally or are not a joined + // member of this room. + if (_requestedParticipants || + participantListComplete || + membership != Membership.join) { return getParticipants(); } + final matrixEvents = await client.getMembersByRoom(id); final users = matrixEvents ?.map((e) => Event.fromMatrixEvent(e, this).asUser)