From 720bc11aa403e98650cf3952232518c9628bd3d5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 7 Nov 2018 16:29:17 +0100 Subject: [PATCH] avoid using roomviewstore for detecting selected room --- src/ActiveRoomObserver.js | 4 ++++ src/components/views/rooms/RoomTile.js | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ActiveRoomObserver.js b/src/ActiveRoomObserver.js index ee3212f611..2561a2e6a3 100644 --- a/src/ActiveRoomObserver.js +++ b/src/ActiveRoomObserver.js @@ -35,6 +35,10 @@ class ActiveRoomObserver { this._roomStoreToken = OpenRoomsStore.addListener(this._onOpenRoomsStoreUpdate.bind(this)); } + getActiveRoomId() { + return this._activeRoomId; + } + addListener(roomId, listener) { if (!this._listeners[roomId]) this._listeners[roomId] = []; this._listeners[roomId].push(listener); diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 71be2df5a4..2bc06ecc7a 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -29,7 +29,6 @@ import * as RoomNotifs from '../../../RoomNotifs'; import * as FormattingUtils from '../../../utils/FormattingUtils'; import AccessibleButton from '../elements/AccessibleButton'; import ActiveRoomObserver from '../../../ActiveRoomObserver'; -import RoomViewStore from '../../../stores/RoomViewStore'; module.exports = React.createClass({ displayName: 'RoomTile', @@ -61,7 +60,7 @@ module.exports = React.createClass({ roomName: this.props.room.name, notifState: RoomNotifs.getRoomNotifsState(this.props.room.roomId), notificationCount: this.props.room.getUnreadNotificationCount(), - selected: this.props.room.roomId === RoomViewStore.getRoomId(), + selected: this.props.room.roomId === ActiveRoomObserver.getActiveRoomId(), }); },