From 7e25e1b2fca0d430411e626c574d0ee4aa9c8351 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 15 Jul 2019 14:02:41 +0200 Subject: [PATCH] remove unneeded else --- src/components/structures/TimelinePanel.js | 45 +++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 5acc55b4d3..6eb1599147 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -1172,34 +1172,33 @@ const TimelinePanel = React.createClass({ // return the index of the first invisible event. if (isInView && adjacentInvisibleEventCount !== 0) { return i + adjacentInvisibleEventCount; - } else { - if (node && !isInView) { - // has node but not in view, so reset adjacent invisible events - adjacentInvisibleEventCount = 0; - } + } + if (node && !isInView) { + // has node but not in view, so reset adjacent invisible events + adjacentInvisibleEventCount = 0; + } - const shouldIgnore = (ignoreEchoes && ev.status) || // local echo - (ignoreOwn && ev.sender && ev.sender.userId == myUserId); // own message - const isWithoutTile = !EventTile.haveTileForEvent(ev) || shouldHideEvent(ev); + const shouldIgnore = (ignoreEchoes && ev.status) || // local echo + (ignoreOwn && ev.sender && ev.sender.userId == myUserId); // own message + const isWithoutTile = !EventTile.haveTileForEvent(ev) || shouldHideEvent(ev); - if (allowEventsWithoutTiles && (isWithoutTile || !node)) { - // don't start counting if the event should be ignored, - // but continue counting if we were already so the offset - // to the previous invisble event that didn't need to be ignored - // doesn't get messed up - if (!shouldIgnore || (shouldIgnore && adjacentInvisibleEventCount !== 0)) { - ++adjacentInvisibleEventCount; - } - continue; + if (allowEventsWithoutTiles && (isWithoutTile || !node)) { + // don't start counting if the event should be ignored, + // but continue counting if we were already so the offset + // to the previous invisble event that didn't need to be ignored + // doesn't get messed up + if (!shouldIgnore || (shouldIgnore && adjacentInvisibleEventCount !== 0)) { + ++adjacentInvisibleEventCount; } + continue; + } - if (shouldIgnore) { - continue; - } + if (shouldIgnore) { + continue; + } - if (isInView) { - return i; - } + if (isInView) { + return i; } }