mirror of https://github.com/vector-im/riot-web
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
parent
fd09d5c570
commit
7879be1704
|
@ -132,8 +132,7 @@ module.exports = React.createClass({
|
|||
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
||||
MatrixClientPeg.get().on("Room.accountData", this.onRoomAccountData);
|
||||
MatrixClientPeg.get().on("RoomState.members", this.onRoomStateMember);
|
||||
// xchat-style tab complete, add a colon if tab
|
||||
// completing at the start of the text
|
||||
|
||||
this.tabComplete = new TabComplete({
|
||||
allowLooping: false,
|
||||
autoEnterTabComplete: true,
|
||||
|
@ -143,7 +142,6 @@ module.exports = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
// if this is an unknown room then we're in one of three states:
|
||||
// - This is a room we can peek into (search engine) (we can /peek)
|
||||
// - This is a room we can publicly join or were invited to. (we can /join)
|
||||
|
|
|
@ -56,7 +56,7 @@ if (DEBUG_SCROLL) {
|
|||
* offset. We don't save the absolute scroll offset, because that would be
|
||||
* affected by window width, zoom level, amount of scrollback, etc. Instead
|
||||
* we save an identifier for the last fully-visible message, and the number
|
||||
* of pixels the window was scrolled below it - which is hopefully be near
|
||||
* of pixels the window was scrolled below it - which is hopefully near
|
||||
* enough.
|
||||
*
|
||||
* The 'stickyBottom' property controls the behaviour when we reach the bottom
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue