Fix case where room list did not show DM when user joined space after filtering
This commit is contained in:
parent
5061db259a
commit
a2fe964a31
1 changed files with 30 additions and 12 deletions
|
@ -294,6 +294,12 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onSpaceMembersChange = (space: Room, ev: MatrixEvent) => {
|
||||||
|
// skip this update if we do not have a DM with this user
|
||||||
|
if (DMRoomMap.shared().getDMRoomsForUserId(ev.getStateKey()).length < 1) return;
|
||||||
|
this.onRoomsUpdate();
|
||||||
|
};
|
||||||
|
|
||||||
private onRoomsUpdate = throttle(() => {
|
private onRoomsUpdate = throttle(() => {
|
||||||
// TODO resolve some updates as deltas
|
// TODO resolve some updates as deltas
|
||||||
const visibleRooms = this.matrixClient.getVisibleRooms();
|
const visibleRooms = this.matrixClient.getVisibleRooms();
|
||||||
|
@ -385,18 +391,30 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
const room = this.matrixClient.getRoom(ev.getRoomId());
|
const room = this.matrixClient.getRoom(ev.getRoomId());
|
||||||
if (!room) return;
|
if (!room) return;
|
||||||
|
|
||||||
if (ev.getType() === EventType.SpaceChild && room.isSpaceRoom()) {
|
switch (ev.getType()) {
|
||||||
this.onSpaceUpdate();
|
case EventType.SpaceChild:
|
||||||
this.emit(room.roomId);
|
if (room.isSpaceRoom()) {
|
||||||
} else if (ev.getType() === EventType.SpaceParent) {
|
this.onSpaceUpdate();
|
||||||
// TODO rebuild the space parent and not the room - check permissions?
|
this.emit(room.roomId);
|
||||||
// TODO confirm this after implementing parenting behaviour
|
}
|
||||||
if (room.isSpaceRoom()) {
|
break;
|
||||||
this.onSpaceUpdate();
|
|
||||||
} else {
|
case EventType.SpaceParent:
|
||||||
this.onRoomUpdate(room);
|
// TODO rebuild the space parent and not the room - check permissions?
|
||||||
}
|
// TODO confirm this after implementing parenting behaviour
|
||||||
this.emit(room.roomId);
|
if (room.isSpaceRoom()) {
|
||||||
|
this.onSpaceUpdate();
|
||||||
|
} else {
|
||||||
|
this.onRoomUpdate(room);
|
||||||
|
}
|
||||||
|
this.emit(room.roomId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EventType.RoomMember:
|
||||||
|
if (room.isSpaceRoom()) {
|
||||||
|
this.onSpaceMembersChange(room, ev);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue