From fe8ea4ffe7dcc5844c52a3baf96563838cac8a90 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 10 May 2017 14:51:47 +0100 Subject: [PATCH] Rename vars, linting --- src/components/structures/TimelinePanel.js | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 26bf9dd400..8a6c80980e 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -177,8 +177,8 @@ var TimelinePanel = React.createClass({ componentWillMount: function() { debuglog("TimelinePanel: mounting"); - this.last_rr_sent_event_id = undefined; - this.last_rm_sent_event_id = undefined; + this.lastRRSentSentId = undefined; + this.lastRMSentEventId = undefined; this.dispatcherRef = dis.register(this.onAction); MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline); @@ -509,8 +509,8 @@ var TimelinePanel = React.createClass({ let shouldSendReadReceipt = true; - var currentReadUpToEventId = this._getCurrentReadReceipt(true); - var currentReadUpToEventIndex = this._indexForEventId(currentReadUpToEventId); + const currentReadUpToEventId = this._getCurrentReadReceipt(true); + const currentReadUpToEventIndex = this._indexForEventId(currentReadUpToEventId); // We want to avoid sending out read receipts when we are looking at // events in the past which are before the latest RR. // @@ -529,33 +529,33 @@ var TimelinePanel = React.createClass({ shouldSendReadReceipt = false; } - var lastReadEventIndex = this._getLastDisplayedEventIndex({ - ignoreOwn: true + const lastReadEventIndex = this._getLastDisplayedEventIndex({ + ignoreOwn: true, }); if (lastReadEventIndex === null) { shouldSendReadReceipt = false; } - - var lastReadEvent = this.state.events[lastReadEventIndex]; + let lastReadEvent = this.state.events[lastReadEventIndex]; shouldSendReadReceipt = shouldSendReadReceipt && // Only send a RR if the last read Event is ahead in the timeline relative to // 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(); + this.lastRRSentSentId != lastReadEvent.getId(); // 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; + const shouldSendReadMarker = + this.lastRMSentEventId != this.state.readMarkerEventId; // we also remember the last read receipt we sent to avoid spamming the // same one at the server repeatedly if (shouldSendReadReceipt || shouldSendReadMarker) { if (shouldSendReadReceipt) { - this.last_rr_sent_event_id = lastReadEvent.getId(); + this.lastRRSentSentId = lastReadEvent.getId(); } else { lastReadEvent = null; } - this.last_rm_sent_event_id = this.state.readMarkerEventId; + this.lastRMSentEventId = this.state.readMarkerEventId; debuglog('TimelinePanel: Sending Read Markers for ', this.props.timelineSet.room.roomId, @@ -572,12 +572,12 @@ var TimelinePanel = React.createClass({ return MatrixClientPeg.get().sendReadReceipt( lastReadEvent, ).catch(() => { - this.last_rr_sent_event_id = undefined; + this.lastRRSentSentId = undefined; }); } // it failed, so allow retries next time the user is active - this.last_rr_sent_event_id = undefined; - this.last_rm_sent_event_id = undefined; + this.lastRRSentSentId = undefined; + this.lastRMSentEventId = undefined; }); // do a quick-reset of our unreadNotificationCount to avoid having