mirror of https://github.com/vector-im/riot-web
fix correct room being highlighted in left panel
parent
1810c17d24
commit
39289e57ac
|
@ -55,24 +55,23 @@ class ActiveRoomObserver {
|
|||
}
|
||||
}
|
||||
|
||||
_emit(roomId) {
|
||||
_emit(roomId, newActiveRoomId) {
|
||||
if (!this._listeners[roomId]) return;
|
||||
|
||||
for (const l of this._listeners[roomId]) {
|
||||
l.call();
|
||||
l.call(l, newActiveRoomId);
|
||||
}
|
||||
}
|
||||
|
||||
_onOpenRoomsStoreUpdate() {
|
||||
// emit for the old room ID
|
||||
if (this._activeRoomId) this._emit(this._activeRoomId);
|
||||
|
||||
const activeRoomStore = OpenRoomsStore.getActiveRoomStore();
|
||||
const newActiveRoomId = activeRoomStore && activeRoomStore.getRoomId();
|
||||
// emit for the old room ID
|
||||
if (this._activeRoomId) this._emit(this._activeRoomId, newActiveRoomId);
|
||||
// update our cache
|
||||
this._activeRoomId = activeRoomStore && activeRoomStore.getRoomId();
|
||||
|
||||
this._activeRoomId = newActiveRoomId;
|
||||
// and emit for the new one
|
||||
if (this._activeRoomId) this._emit(this._activeRoomId);
|
||||
if (this._activeRoomId) this._emit(this._activeRoomId, this._activeRoomId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue