From c9459feb59a3dc05de229aea7652b0a726ac98bf Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Mon, 13 Jul 2015 13:18:50 -0700
Subject: When removed from a channel, user is sent back to town square and
 that channel is removed from their sidebar

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

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 3cf67e410..ed75e51cf 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -197,6 +197,14 @@ module.exports = React.createClass({
             if (UserStore.getCurrentId() === msg.user_id) {
                 AsyncClient.getChannels(true);
             }
+        } else if(msg.action === "user_removed") {
+            if(msg.user_id === UserStore.getCurrentId()) {
+                AsyncClient.getChannels(true);
+
+                if(msg.props.channel_id === ChannelStore.getCurrentId()) {
+                    window.location.reload();
+                }
+            }
         }
     },
     updateTitle: function() {
-- 
cgit v1.2.3-1-g7c22


From ed70db18611331de99b2a86b580947e56d0cb7e5 Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Wed, 22 Jul 2015 15:12:50 -0700
Subject: When user is removed, a modal appears, which on closing redirects the
 user to town square.

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

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index ed75e51cf..a29c6a903 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -201,8 +201,13 @@ module.exports = React.createClass({
             if(msg.user_id === UserStore.getCurrentId()) {
                 AsyncClient.getChannels(true);
 
-                if(msg.props.channel_id === ChannelStore.getCurrentId()) {
-                    window.location.reload();
+                if(msg.props.channel_id === ChannelStore.getCurrentId() && $('#removed_from_channel').length > 0) {
+                    var channelName = ChannelStore.getCurrent().display_name;
+                    var curUser = UserStore.getProfile(msg.props.remover).username;
+                    $('#removed_from_channel').find('.modal-title').text("Removed from " + channelName);
+                    $('#removed_from_channel').find('.modal-body').children().text(curUser + " removed you from " + channelName);
+
+                    $('#removed_from_channel').modal('show');
                 }
             }
         }
-- 
cgit v1.2.3-1-g7c22


From da6d3556e83b54472f1caa7777ce223988c0655c Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Mon, 27 Jul 2015 13:44:54 -0700
Subject: Changed from Jquery style modal modification to using browserStore

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

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

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index a29c6a903..5b8d6c542 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -7,6 +7,7 @@ var AsyncClient = require('../utils/async_client.jsx');
 var SocketStore = require('../stores/socket_store.jsx');
 var UserStore = require('../stores/user_store.jsx');
 var TeamStore = require('../stores/team_store.jsx');
+var BrowserStore = require('../stores/browser_store.jsx')
 var utils = require('../utils/utils.jsx');
 var SidebarHeader = require('./sidebar_header.jsx');
 var SearchBox = require('./search_bar.jsx');
@@ -202,11 +203,11 @@ module.exports = React.createClass({
                 AsyncClient.getChannels(true);
 
                 if(msg.props.channel_id === ChannelStore.getCurrentId() && $('#removed_from_channel').length > 0) {
-                    var channelName = ChannelStore.getCurrent().display_name;
-                    var curUser = UserStore.getProfile(msg.props.remover).username;
-                    $('#removed_from_channel').find('.modal-title').text("Removed from " + channelName);
-                    $('#removed_from_channel').find('.modal-body').children().text(curUser + " removed you from " + channelName);
+                    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');
                 }
             }
-- 
cgit v1.2.3-1-g7c22

