update RoomTile notificationCount through props so updates are consistent
parent
6f9aa9c9b9
commit
b6aa72da55
|
@ -145,6 +145,7 @@ const RoomSubList = React.createClass({
|
||||||
collapsed={this.props.collapsed || false}
|
collapsed={this.props.collapsed || false}
|
||||||
unread={Unread.doesRoomHaveUnreadMessages(room)}
|
unread={Unread.doesRoomHaveUnreadMessages(room)}
|
||||||
highlight={room.getUnreadNotificationCount('highlight') > 0 || this.props.isInvite}
|
highlight={room.getUnreadNotificationCount('highlight') > 0 || this.props.isInvite}
|
||||||
|
notificationCount={room.getUnreadNotificationCount()}
|
||||||
isInvite={this.props.isInvite}
|
isInvite={this.props.isInvite}
|
||||||
refreshSubList={this._updateSubListCount}
|
refreshSubList={this._updateSubListCount}
|
||||||
incomingCall={null}
|
incomingCall={null}
|
||||||
|
|
|
@ -108,13 +108,6 @@ module.exports = React.createClass({
|
||||||
return statusUser._unstable_statusMessage;
|
return statusUser._unstable_statusMessage;
|
||||||
},
|
},
|
||||||
|
|
||||||
onRoomTimeline: function(ev, room) {
|
|
||||||
if (room !== this.props.room) return;
|
|
||||||
this.setState({
|
|
||||||
notificationCount: this.props.room.getUnreadNotificationCount(),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onRoomName: function(room) {
|
onRoomName: function(room) {
|
||||||
if (room !== this.props.room) return;
|
if (room !== this.props.room) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -159,7 +152,6 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
MatrixClientPeg.get().on("accountData", this.onAccountData);
|
MatrixClientPeg.get().on("accountData", this.onAccountData);
|
||||||
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
|
||||||
MatrixClientPeg.get().on("Room.name", this.onRoomName);
|
MatrixClientPeg.get().on("Room.name", this.onRoomName);
|
||||||
ActiveRoomObserver.addListener(this.props.room.roomId, this._onActiveRoomChange);
|
ActiveRoomObserver.addListener(this.props.room.roomId, this._onActiveRoomChange);
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
|
@ -179,7 +171,6 @@ module.exports = React.createClass({
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (cli) {
|
if (cli) {
|
||||||
MatrixClientPeg.get().removeListener("accountData", this.onAccountData);
|
MatrixClientPeg.get().removeListener("accountData", this.onAccountData);
|
||||||
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
|
||||||
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
MatrixClientPeg.get().removeListener("Room.name", this.onRoomName);
|
||||||
}
|
}
|
||||||
ActiveRoomObserver.removeListener(this.props.room.roomId, this._onActiveRoomChange);
|
ActiveRoomObserver.removeListener(this.props.room.roomId, this._onActiveRoomChange);
|
||||||
|
@ -306,7 +297,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const isInvite = this.props.room.getMyMembership() === "invite";
|
const isInvite = this.props.room.getMyMembership() === "invite";
|
||||||
const notificationCount = this.state.notificationCount;
|
const notificationCount = this.props.notificationCount;
|
||||||
// var highlightCount = this.props.room.getUnreadNotificationCount("highlight");
|
// var highlightCount = this.props.room.getUnreadNotificationCount("highlight");
|
||||||
|
|
||||||
const notifBadges = notificationCount > 0 && this._shouldShowNotifBadge();
|
const notifBadges = notificationCount > 0 && this._shouldShowNotifBadge();
|
||||||
|
|
Loading…
Reference in New Issue