implement basic local echo for resetting unread message count when opening a room without a scroll offset. hopefully largely fixes https://github.com/vector-im/vector-web/issues/967

This commit is contained in:
Matthew Hodgson 2016-05-17 20:28:11 +01:00
parent fd09d5c570
commit 7879be1704
3 changed files with 10 additions and 4 deletions

View file

@ -399,6 +399,14 @@ var TimelinePanel = React.createClass({
sendReadReceipt: function() {
if (!this.refs.messagePanel) return;
// if we are scrolled to the bottom, do a quick-reset of our unreadNotificationCount
// to avoid having to wait from the remote echo from the homeserver.
if (this.getScrollState().stuckAtBottom) {
this.props.room.setUnreadNotificationCount('total', 0);
this.props.room.setUnreadNotificationCount('highlight', 0);
// XXX: i'm a bit surprised we don't have to emit an event or dispatch to make the echo picked up
}
var currentReadUpToEventId = this._getCurrentReadReceipt(true);
var currentReadUpToEventIndex = this._indexForEventId(currentReadUpToEventId);