Fix leaved room appear in category & search

This commit is contained in:
Ajay Bura 2022-08-20 13:26:12 +05:30
parent a5878e9de6
commit e801aa538d
2 changed files with 4 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import { selectTab, selectSpace, selectRoom } from '../action/navigation';
function initRoomListListener(roomList) { function initRoomListListener(roomList) {
const listenRoomLeave = (roomId) => { const listenRoomLeave = (roomId) => {
const parents = roomList.roomIdToParents.get(roomId); const parents = roomList.roomIdToParents.get(roomId);
if (parents) { if (parents) {
[...parents].forEach((pId) => { [...parents].forEach((pId) => {
const data = navigation.spaceToRoom.get(pId); const data = navigation.spaceToRoom.get(pId);
@ -23,6 +24,8 @@ function initRoomListListener(roomList) {
if (idIndex === 0) selectTab(cons.tabs.HOME); if (idIndex === 0) selectTab(cons.tabs.HOME);
else selectSpace(navigation.selectedSpacePath[idIndex - 1]); else selectSpace(navigation.selectedSpacePath[idIndex - 1]);
} }
navigation.removeRecentRoom(roomId);
}; };
roomList.on(cons.events.roomList.ROOM_LEAVED, listenRoomLeave); roomList.on(cons.events.roomList.ROOM_LEAVED, listenRoomLeave);

View file

@ -89,7 +89,7 @@ class RoomList extends EventEmitter {
child.forEach((childId) => { child.forEach((childId) => {
const room = this.matrixClient.getRoom(childId); const room = this.matrixClient.getRoom(childId);
if (room === null) return; if (room === null || room.getMyMembership() !== 'join') return;
if (room.isSpaceRoom()) categorizeSpace(childId); if (room.isSpaceRoom()) categorizeSpace(childId);
else mappedChild.add(childId); else mappedChild.add(childId);
}); });