avoid using roomviewstore for detecting selected room

This commit is contained in:
Bruno Windels 2018-11-07 16:29:17 +01:00
parent 78d5d7ac0c
commit 720bc11aa4
2 changed files with 5 additions and 2 deletions

View file

@ -35,6 +35,10 @@ class ActiveRoomObserver {
this._roomStoreToken = OpenRoomsStore.addListener(this._onOpenRoomsStoreUpdate.bind(this)); this._roomStoreToken = OpenRoomsStore.addListener(this._onOpenRoomsStoreUpdate.bind(this));
} }
getActiveRoomId() {
return this._activeRoomId;
}
addListener(roomId, listener) { addListener(roomId, listener) {
if (!this._listeners[roomId]) this._listeners[roomId] = []; if (!this._listeners[roomId]) this._listeners[roomId] = [];
this._listeners[roomId].push(listener); this._listeners[roomId].push(listener);

View file

@ -29,7 +29,6 @@ import * as RoomNotifs from '../../../RoomNotifs';
import * as FormattingUtils from '../../../utils/FormattingUtils'; import * as FormattingUtils from '../../../utils/FormattingUtils';
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
import ActiveRoomObserver from '../../../ActiveRoomObserver'; import ActiveRoomObserver from '../../../ActiveRoomObserver';
import RoomViewStore from '../../../stores/RoomViewStore';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'RoomTile', displayName: 'RoomTile',
@ -61,7 +60,7 @@ module.exports = React.createClass({
roomName: this.props.room.name, roomName: this.props.room.name,
notifState: RoomNotifs.getRoomNotifsState(this.props.room.roomId), notifState: RoomNotifs.getRoomNotifsState(this.props.room.roomId),
notificationCount: this.props.room.getUnreadNotificationCount(), notificationCount: this.props.room.getUnreadNotificationCount(),
selected: this.props.room.roomId === RoomViewStore.getRoomId(), selected: this.props.room.roomId === ActiveRoomObserver.getActiveRoomId(),
}); });
}, },