mirror of https://github.com/vector-im/riot-web
Rename variables, more comments
parent
ca79d9bb6e
commit
7f766d89c3
|
@ -507,7 +507,7 @@ var TimelinePanel = React.createClass({
|
||||||
// if no client or client is guest don't send RR or RM
|
// if no client or client is guest don't send RR or RM
|
||||||
if (!cli || cli.isGuest()) return;
|
if (!cli || cli.isGuest()) return;
|
||||||
|
|
||||||
let shouldSendRR = true;
|
let shouldSendReadReceipt = true;
|
||||||
|
|
||||||
var currentReadUpToEventId = this._getCurrentReadReceipt(true);
|
var currentReadUpToEventId = this._getCurrentReadReceipt(true);
|
||||||
var currentReadUpToEventIndex = this._indexForEventId(currentReadUpToEventId);
|
var currentReadUpToEventIndex = this._indexForEventId(currentReadUpToEventId);
|
||||||
|
@ -526,26 +526,30 @@ var TimelinePanel = React.createClass({
|
||||||
//
|
//
|
||||||
if (currentReadUpToEventId && currentReadUpToEventIndex === null &&
|
if (currentReadUpToEventId && currentReadUpToEventIndex === null &&
|
||||||
this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
|
this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
|
||||||
shouldSendRR = false;
|
shouldSendReadReceipt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastReadEventIndex = this._getLastDisplayedEventIndex({
|
var lastReadEventIndex = this._getLastDisplayedEventIndex({
|
||||||
ignoreOwn: true
|
ignoreOwn: true
|
||||||
});
|
});
|
||||||
if (lastReadEventIndex === null) {
|
if (lastReadEventIndex === null) {
|
||||||
shouldSendRR = false;
|
shouldSendReadReceipt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastReadEvent = this.state.events[lastReadEventIndex];
|
var lastReadEvent = this.state.events[lastReadEventIndex];
|
||||||
shouldSendRR = shouldSendRR &&
|
shouldSendReadReceipt = shouldSendReadReceipt &&
|
||||||
(lastReadEventIndex > currentReadUpToEventIndex &&
|
// Only send a RR if the last read Event is ahead in the timeline relative to
|
||||||
this.last_rr_sent_event_id != lastReadEvent.getId());
|
// the current RR event.
|
||||||
|
lastReadEventIndex > currentReadUpToEventIndex &&
|
||||||
|
// Only send a RR if the last RR set != the one we would send
|
||||||
|
this.last_rr_sent_event_id != lastReadEvent.getId();
|
||||||
|
|
||||||
const shouldSendRM = this.last_rm_sent_event_id != this.state.readMarkerEventId;
|
// Only send a RM if the last RM sent != the one we would send
|
||||||
|
const shouldSendReadMarker = this.last_rm_sent_event_id != this.state.readMarkerEventId;
|
||||||
|
|
||||||
// we also remember the last read receipt we sent to avoid spamming the
|
// we also remember the last read receipt we sent to avoid spamming the
|
||||||
// same one at the server repeatedly
|
// same one at the server repeatedly
|
||||||
if (shouldSendRR || shouldSendRM) {
|
if (shouldSendReadReceipt || shouldSendReadMarker) {
|
||||||
this.last_rr_sent_event_id = lastReadEvent.getId();
|
this.last_rr_sent_event_id = lastReadEvent.getId();
|
||||||
this.last_rm_sent_event_id = this.state.readMarkerEventId;
|
this.last_rm_sent_event_id = this.state.readMarkerEventId;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue