Rename some variables

`ReadUpTo` -> `RR`
`ReadReceipt` -> `RR`
`ReadMarker` -> `RM`
pull/21833/head
Luke Barnard 2017-05-11 09:31:59 +01:00
parent 3815ad6cd0
commit 852e1eb720
1 changed files with 11 additions and 11 deletions

View File

@ -507,10 +507,10 @@ 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 shouldSendReadReceipt = true; let shouldSendRR = true;
const currentReadUpToEventId = this._getCurrentReadReceipt(true); const currentRREventId = this._getCurrentReadReceipt(true);
const currentReadUpToEventIndex = this._indexForEventId(currentReadUpToEventId); const currentRREventIndex = this._indexForEventId(currentRREventId);
// We want to avoid sending out read receipts when we are looking at // We want to avoid sending out read receipts when we are looking at
// events in the past which are before the latest RR. // events in the past which are before the latest RR.
// //
@ -524,33 +524,33 @@ var TimelinePanel = React.createClass({
// RRs) - but that is a bit of a niche case. It will sort itself out when // RRs) - but that is a bit of a niche case. It will sort itself out when
// the user eventually hits the live timeline. // the user eventually hits the live timeline.
// //
if (currentReadUpToEventId && currentReadUpToEventIndex === null && if (currentRREventId && currentRREventIndex === null &&
this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) { this._timelineWindow.canPaginate(EventTimeline.FORWARDS)) {
shouldSendReadReceipt = false; shouldSendRR = false;
} }
const lastReadEventIndex = this._getLastDisplayedEventIndex({ const lastReadEventIndex = this._getLastDisplayedEventIndex({
ignoreOwn: true, ignoreOwn: true,
}); });
if (lastReadEventIndex === null) { if (lastReadEventIndex === null) {
shouldSendReadReceipt = false; shouldSendRR = false;
} }
let lastReadEvent = this.state.events[lastReadEventIndex]; let lastReadEvent = this.state.events[lastReadEventIndex];
shouldSendReadReceipt = shouldSendReadReceipt && shouldSendRR = shouldSendRR &&
// Only send a RR if the last read event is ahead in the timeline relative to // Only send a RR if the last read event is ahead in the timeline relative to
// the current RR event. // the current RR event.
lastReadEventIndex > currentReadUpToEventIndex && lastReadEventIndex > currentRREventIndex &&
// Only send a RR if the last RR set != the one we would send // Only send a RR if the last RR set != the one we would send
this.lastRRSentEventId != lastReadEvent.getId(); this.lastRRSentEventId != lastReadEvent.getId();
// Only send a RM if the last RM sent != the one we would send // Only send a RM if the last RM sent != the one we would send
const shouldSendReadMarker = const shouldSendRM =
this.lastRMSentEventId != this.state.readMarkerEventId; this.lastRMSentEventId != 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 (shouldSendReadReceipt || shouldSendReadMarker) { if (shouldSendRR || shouldSendRM) {
if (shouldSendReadReceipt) { if (shouldSendRR) {
this.lastRRSentEventId = lastReadEvent.getId(); this.lastRRSentEventId = lastReadEvent.getId();
} else { } else {
lastReadEvent = null; lastReadEvent = null;