From 495673d80d75ddfc97dc8d9fe61021142418dcc2 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Fri, 16 Oct 2015 10:15:52 -0400
Subject: Fixing some client warnings

---
 web/react/components/sidebar.jsx | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 89506c028..889bc0fbd 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -46,7 +46,7 @@ export default class Sidebar extends React.Component {
 
         const state = this.getStateFromStores();
         state.newChannelModalType = '';
-        state.showMoreDirectChannelsModal = false;
+        state.showDirectChannelsModal = false;
         state.loadingDMChannel = -1;
 
         this.state = state;
@@ -471,11 +471,13 @@ export default class Sidebar extends React.Component {
         }
 
         let closeButton = null;
-        const removeTooltip = <Tooltip>{'Remove from list'}</Tooltip>;
+        const removeTooltip = (
+            <Tooltip id='remove-dm-tooltip'>{'Remove from list'}</Tooltip>
+        );
         if (handleClose && !badge) {
             closeButton = (
                 <OverlayTrigger
-                    delayShow='1000'
+                    delayShow={1000}
                     placement='top'
                     overlay={removeTooltip}
                 >
@@ -564,8 +566,12 @@ export default class Sidebar extends React.Component {
             showChannelModal = true;
         }
 
-        const createChannelTootlip = <Tooltip>{'Create new channel'}</Tooltip>;
-        const createGroupTootlip = <Tooltip>{'Create new group'}</Tooltip>;
+        const createChannelTootlip = (
+            <Tooltip id='new-channel-tooltip' >{'Create new channel'}</Tooltip>
+        );
+        const createGroupTootlip = (
+            <Tooltip id='new-group-tooltip'>{'Create new group'}</Tooltip>
+        );
 
         return (
             <div>
@@ -607,7 +613,7 @@ export default class Sidebar extends React.Component {
                             <h4>
                                 {'Channels'}
                                 <OverlayTrigger
-                                    delayShow='500'
+                                    delayShow={500}
                                     placement='top'
                                     overlay={createChannelTootlip}
                                 >
@@ -640,7 +646,7 @@ export default class Sidebar extends React.Component {
                             <h4>
                                 {'Private Groups'}
                                 <OverlayTrigger
-                                    delayShow='500'
+                                    delayShow={500}
                                     placement='top'
                                     overlay={createGroupTootlip}
                                 >
-- 
cgit v1.2.3-1-g7c22


From 2b5ec4a3c076bb1f18eeafbd96b0a80c6b8bfbaa Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Thu, 15 Oct 2015 10:44:04 -0400
Subject: Small refactor of websocket code on client and server

---
 web/react/components/sidebar.jsx | 92 ----------------------------------------
 1 file changed, 92 deletions(-)

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 89506c028..6b582882e 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -2,7 +2,6 @@
 // See License.txt for license information.
 
 const AsyncClient = require('../utils/async_client.jsx');
-const BrowserStore = require('../stores/browser_store.jsx');
 const ChannelStore = require('../stores/channel_store.jsx');
 const Client = require('../utils/client.jsx');
 const Constants = require('../utils/constants.jsx');
@@ -11,7 +10,6 @@ const NewChannelFlow = require('./new_channel_flow.jsx');
 const MoreDirectChannels = require('./more_direct_channels.jsx');
 const SearchBox = require('./search_bar.jsx');
 const SidebarHeader = require('./sidebar_header.jsx');
-const SocketStore = require('../stores/socket_store.jsx');
 const TeamStore = require('../stores/team_store.jsx');
 const UnreadChannelIndicator = require('./unread_channel_indicator.jsx');
 const UserStore = require('../stores/user_store.jsx');
@@ -129,7 +127,6 @@ export default class Sidebar extends React.Component {
         UserStore.addChangeListener(this.onChange);
         UserStore.addStatusesChangeListener(this.onChange);
         TeamStore.addChangeListener(this.onChange);
-        SocketStore.addChangeListener(this.onSocketChange);
         PreferenceStore.addChangeListener(this.onChange);
 
         $('.nav-pills__container').perfectScrollbar();
@@ -160,7 +157,6 @@ export default class Sidebar extends React.Component {
         UserStore.removeChangeListener(this.onChange);
         UserStore.removeStatusesChangeListener(this.onChange);
         TeamStore.removeChangeListener(this.onChange);
-        SocketStore.removeChangeListener(this.onSocketChange);
         PreferenceStore.removeChangeListener(this.onChange);
     }
     onChange() {
@@ -169,94 +165,6 @@ export default class Sidebar extends React.Component {
             this.setState(newState);
         }
     }
-    onSocketChange(msg) {
-        if (msg.action === 'posted') {
-            if (ChannelStore.getCurrentId() === msg.channel_id) {
-                if (window.isActive) {
-                    AsyncClient.updateLastViewedAt();
-                }
-            } else {
-                AsyncClient.getChannels();
-            }
-
-            if (UserStore.getCurrentId() !== msg.user_id) {
-                var mentions = [];
-                if (msg.props.mentions) {
-                    mentions = JSON.parse(msg.props.mentions);
-                }
-                var channel = ChannelStore.get(msg.channel_id);
-
-                const user = UserStore.getCurrentUser();
-                const member = ChannelStore.getMember(msg.channel_id);
-
-                var notifyLevel = member && member.notify_props ? member.notify_props.desktop : 'default';
-                if (notifyLevel === 'default') {
-                    notifyLevel = user.notify_props.desktop;
-                }
-
-                if (notifyLevel === 'none') {
-                    return;
-                } else if (notifyLevel === 'mention' && mentions.indexOf(user.id) === -1 && channel.type !== 'D') {
-                    return;
-                }
-
-                var username = 'Someone';
-                if (UserStore.hasProfile(msg.user_id)) {
-                    username = UserStore.getProfile(msg.user_id).username;
-                }
-
-                var title = 'Posted';
-                if (channel) {
-                    title = channel.display_name;
-                }
-
-                var repRegex = new RegExp('<br>', 'g');
-                var post = JSON.parse(msg.props.post);
-                var msgProps = msg.props;
-                var notifyText = post.message.replace(repRegex, '\n').replace(/\n+/g, ' ').replace('<mention>', '').replace('</mention>', '');
-
-                if (notifyText.length > 50) {
-                    notifyText = notifyText.substring(0, 49) + '...';
-                }
-
-                if (notifyText.length === 0) {
-                    if (msgProps.image) {
-                        Utils.notifyMe(title, username + ' uploaded an image', channel);
-                    } else if (msgProps.otherFile) {
-                        Utils.notifyMe(title, username + ' uploaded a file', channel);
-                    } else {
-                        Utils.notifyMe(title, username + ' did something new', channel);
-                    }
-                } else {
-                    Utils.notifyMe(title, username + ' wrote: ' + notifyText, channel);
-                }
-                if (!user.notify_props || user.notify_props.desktop_sound === 'true') {
-                    Utils.ding();
-                }
-            }
-        } else if (msg.action === 'viewed') {
-            if (ChannelStore.getCurrentId() !== msg.channel_id && UserStore.getCurrentId() === msg.user_id) {
-                AsyncClient.getChannel(msg.channel_id);
-            }
-        } else if (msg.action === 'user_added') {
-            if (UserStore.getCurrentId() === msg.user_id) {
-                AsyncClient.getChannel(msg.channel_id);
-            }
-        } else if (msg.action === 'user_removed') {
-            if (msg.user_id === UserStore.getCurrentId()) {
-                AsyncClient.getChannels(true);
-
-                if (msg.props.remover !== msg.user_id && msg.props.channel_id === ChannelStore.getCurrentId() && $('#removed_from_channel').length > 0) {
-                    var sentState = {};
-                    sentState.channelName = ChannelStore.getCurrent().display_name;
-                    sentState.remover = UserStore.getProfile(msg.props.remover).username;
-
-                    BrowserStore.setItem('channel-removed-state', sentState);
-                    $('#removed_from_channel').modal('show');
-                }
-            }
-        }
-    }
     updateTitle() {
         const channel = ChannelStore.getCurrent();
         if (channel) {
-- 
cgit v1.2.3-1-g7c22


From 13a35539f335c44cebdd285cc6b2e27ffeea3a75 Mon Sep 17 00:00:00 2001
From: Asaad Mahmood <Unknowngi@live.com>
Date: Mon, 19 Oct 2015 14:36:31 +0500
Subject: Updating scroll on LHS

---
 web/react/components/sidebar.jsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 889bc0fbd..6e4a53e1b 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -132,7 +132,9 @@ export default class Sidebar extends React.Component {
         SocketStore.addChangeListener(this.onSocketChange);
         PreferenceStore.addChangeListener(this.onChange);
 
-        $('.nav-pills__container').perfectScrollbar();
+        if ($(window).width() > 768) {
+            $('.nav-pills__container').perfectScrollbar();
+        }
 
         this.updateTitle();
         this.updateUnreadIndicators();
-- 
cgit v1.2.3-1-g7c22

