summaryrefslogtreecommitdiffstats
path: root/web/react/components/sidebar.jsx
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-08-13 11:00:49 -0700
committernickago <ngonella@calpoly.edu>2015-08-13 11:00:49 -0700
commit7203128e999fdd34c92352808ad506746ea64dad (patch)
treeb6fa3b76df5d214f0140dced2b2688c21b2e6d02 /web/react/components/sidebar.jsx
parent6d9e715e265a3265841bc351e6b22a4503c20c92 (diff)
downloadchat-7203128e999fdd34c92352808ad506746ea64dad.tar.gz
chat-7203128e999fdd34c92352808ad506746ea64dad.tar.bz2
chat-7203128e999fdd34c92352808ad506746ea64dad.zip
Added flux-style error protection on team store call in sidebar
Diffstat (limited to 'web/react/components/sidebar.jsx')
-rw-r--r--web/react/components/sidebar.jsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index fe73cbcf7..2f1e237ee 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -128,6 +128,7 @@ module.exports = React.createClass({
ChannelStore.addChangeListener(this.onChange);
UserStore.addChangeListener(this.onChange);
UserStore.addStatusesChangeListener(this.onChange);
+ TeamStore.addChangeListener(this.onChange);
SocketStore.addChangeListener(this.onSocketChange);
$('.nav-pills__container').perfectScrollbar();
@@ -146,6 +147,7 @@ module.exports = React.createClass({
ChannelStore.removeChangeListener(this.onChange);
UserStore.removeChangeListener(this.onChange);
UserStore.removeStatusesChangeListener(this.onChange);
+ TeamStore.removeChangeListener(this.onChange);
SocketStore.removeChangeListener(this.onSocketChange);
},
onChange: function() {
@@ -346,15 +348,16 @@ module.exports = React.createClass({
// set up click handler to switch channels (or create a new channel for non-existant ones)
var clickHandler = null;
- var href;
+ var href = '#';
+ var teamURL = TeamStore.getCurrentTeamUrl();
if (!channel.fake) {
clickHandler = function(e) {
e.preventDefault();
utils.switchChannel(channel);
};
- href = '#';
- } else {
- href = TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name;
+ }
+ if (channel.fake && teamURL){
+ href = teamURL + '/channels/' + channel.name;
}
return (