From 8d0c69aec62a0b48db353f40769d3c4baded8e87 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 14 Sep 2015 16:56:20 -0400
Subject: Properly hide unread channel indicators when there are no unread
 channels

---
 web/react/components/sidebar.jsx | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 697fc09c9..370250e4a 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -274,26 +274,32 @@ export default class Sidebar extends React.Component {
         this.updateUnreadIndicators();
     }
     updateUnreadIndicators() {
-        var container = $(React.findDOMNode(this.refs.container));
+        const container = $(React.findDOMNode(this.refs.container));
+        const topUnreadIndicator = $(React.findDOMNode(this.refs.topUnreadIndicator));
+        const bottomUnreadIndicator = $(React.findDOMNode(this.refs.bottomUnreadIndicator));
 
         if (this.firstUnreadChannel) {
             var firstUnreadElement = $(React.findDOMNode(this.refs[this.firstUnreadChannel]));
 
             if (firstUnreadElement.position().top + firstUnreadElement.height() < 0) {
-                $(React.findDOMNode(this.refs.topUnreadIndicator)).css('display', 'initial');
+                topUnreadIndicator.css('display', 'initial');
             } else {
-                $(React.findDOMNode(this.refs.topUnreadIndicator)).css('display', 'none');
+                topUnreadIndicator.css('display', 'none');
             }
+        } else {
+            topUnreadIndicator.css('display', 'none');
         }
 
         if (this.lastUnreadChannel) {
             var lastUnreadElement = $(React.findDOMNode(this.refs[this.lastUnreadChannel]));
 
             if (lastUnreadElement.position().top > container.height()) {
-                $(React.findDOMNode(this.refs.bottomUnreadIndicator)).css('display', 'initial');
+                bottomUnreadIndicator.css('display', 'initial');
             } else {
-                $(React.findDOMNode(this.refs.bottomUnreadIndicator)).css('display', 'none');
+                bottomUnreadIndicator.css('display', 'none');
             }
+        } else {
+            bottomUnreadIndicator.css('display', 'none');
         }
     }
     createChannelElement(channel, index) {
-- 
cgit v1.2.3-1-g7c22

