add algo to ensure that RM always moves forwards

this is needed so that if a client which does not hide any events
sets and RM at bottom of timeline, then riot-web which hides events
sets the RM it'd set it at X-N where X is bottom and N is the amount of
hidden events at bottom of the timeline, this way now an RM will
fall through to the hidden events below a seen event.

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-07-22 13:10:57 +01:00
parent b976649b5b
commit c9b547368b
No known key found for this signature in database
GPG key ID: 0435A1D4BBD34D64

View file

@ -1020,7 +1020,14 @@ var TimelinePanel = React.createClass({
var boundingRect = node.getBoundingClientRect();
if ((allowPartial && boundingRect.top < wrapperRect.bottom) ||
(!allowPartial && boundingRect.bottom < wrapperRect.bottom)) {
return i;
let latestReadEventIndex = i;
// Place the RM at a hidden event below the latest seen event (if exists)
// to prevent RM going up the timeline between clients which do not hide the same events.
for (let j = i; j < this.state.events.length; ++j) {
if (messagePanel._shouldShowEvent(this.state.events[j])) break;
latestReadEventIndex = j;
}
return latestReadEventIndex;
}
}
return null;