From b03b9d736297a536bb1385c80f76f55473c9f637 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Fri, 7 Jul 2017 18:29:32 +0100 Subject: Minor fixes based on lgtm.com alerts (#6819) * Remove a couple of superfluous trailing arguments * Simplify assignment logic in a couple of places * Modify some potentially inconsistent setState calls to use the function form * Fix eslint errors --- webapp/components/sidebar.jsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'webapp/components/sidebar.jsx') diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index 16c96f1b6..798ce5691 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -309,14 +309,13 @@ export default class Sidebar extends React.Component { curIndex = i; } } - let nextChannel = allChannels[curIndex]; let nextIndex = curIndex; if (e.keyCode === Constants.KeyCodes.DOWN) { nextIndex = curIndex + 1; } else if (e.keyCode === Constants.KeyCodes.UP) { nextIndex = curIndex - 1; } - nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)]; + const nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)]; ChannelActions.goToChannel(nextChannel); this.updateScrollbarOnChannelChange(nextChannel); this.isSwitchingChannel = false; @@ -342,7 +341,6 @@ export default class Sidebar extends React.Component { curIndex = i; } } - let nextChannel = allChannels[curIndex]; let nextIndex = curIndex; let count = 0; let increment = 0; @@ -359,7 +357,7 @@ export default class Sidebar extends React.Component { unreadCounts = ChannelStore.getUnreadCount(allChannels[nextIndex].id); } if (unreadCounts.msgs !== 0 || unreadCounts.mentions !== 0) { - nextChannel = allChannels[nextIndex]; + const nextChannel = allChannels[nextIndex]; ChannelActions.goToChannel(nextChannel); this.updateScrollbarOnChannelChange(nextChannel); } -- cgit v1.2.3-1-g7c22