diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index ba2b91aa2c..05fe52aa2b 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -361,7 +361,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient { const space = this.matrixClient?.getRoom(spaceId); // Add relevant DMs - space?.getJoinedMembers().forEach(member => { + space?.getMembers().forEach(member => { + if (member.membership !== "join" && member.membership !== "invite") return; DMRoomMap.shared().getDMRoomsForUserId(member.userId).forEach(roomId => { roomIds.add(roomId); }); diff --git a/test/test-utils.js b/test/test-utils.js index 953693a820..bad3547133 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -234,6 +234,7 @@ export function mkStubRoom(roomId = null) { }), getMembersWithMembership: jest.fn().mockReturnValue([]), getJoinedMembers: jest.fn().mockReturnValue([]), + getMembers: jest.fn().mockReturnValue([]), getPendingEvents: () => [], getLiveTimeline: () => stubTimeline, getUnfilteredTimelineSet: () => null,