From aff05eff48d5508ba96da3ea5fe943c9abf0ffc2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 26 Mar 2021 11:48:31 +0000 Subject: [PATCH] Fix suggested room vanishing when you peek it --- src/stores/SpaceStore.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index d269f6c415..dec8832792 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -122,7 +122,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient { const data = await this.fetchSuggestedRooms(space); if (this._activeSpace === space) { this._suggestedRooms = data.rooms.filter(roomInfo => { - return roomInfo.room_type !== RoomType.Space && !this.matrixClient.getRoom(roomInfo.room_id); + return roomInfo.room_type !== RoomType.Space + && this.matrixClient.getRoom(roomInfo.room_id)?.getMyMembership() !== "join"; }); this.emit(SUGGESTED_ROOMS, this._suggestedRooms); } @@ -380,10 +381,12 @@ export class SpaceStoreClass extends AsyncStoreWithClient { this.setActiveSpace(room); } - const numSuggestedRooms = this._suggestedRooms.length; - this._suggestedRooms = this._suggestedRooms.filter(r => r.room_id !== room.roomId); - if (numSuggestedRooms !== this._suggestedRooms.length) { - this.emit(SUGGESTED_ROOMS, this._suggestedRooms); + if (room.getMyMembership() === "join") { + const numSuggestedRooms = this._suggestedRooms.length; + this._suggestedRooms = this._suggestedRooms.filter(r => r.room_id !== room.roomId); + if (numSuggestedRooms !== this._suggestedRooms.length) { + this.emit(SUGGESTED_ROOMS, this._suggestedRooms); + } } };