Handle casing differences between join commands and actual channel names

This commit is contained in:
khlieng 2015-02-13 00:17:45 +01:00
parent 17e88b6e46
commit 42e8f2547d
2 changed files with 18 additions and 6 deletions

View File

@ -20,10 +20,10 @@
"gulp-gzip": "0.0.8"
},
"dependencies": {
"lodash": "3.0.0",
"reflux": "0.2.4",
"react-router": "~0.11.6",
"react": "~0.12.2",
"react-infinite": "~0.2.2"
"lodash": "3.2.0",
"reflux": "0.2.5",
"react-router": "0.12.0",
"react": "0.12.2",
"react-infinite": "0.2.3"
}
}
}

View File

@ -18,6 +18,7 @@ var selectedTabStore = Reflux.createStore({
this.listenToMany(actions);
this.listenTo(channelActions.part, 'part');
this.listenTo(serverActions.disconnect, 'disconnect');
this.listenTo(channelActions.addUser, 'userAdded');
this.listenTo(channelActions.load, 'loadChannels');
this.listenTo(serverActions.load, 'loadServers');
},
@ -51,6 +52,17 @@ var selectedTabStore = Reflux.createStore({
}
},
userAdded: function(user, server, channel) {
// Update the selected channel incase the casing is different
if (server === selectedTab.server &&
channel.toLowerCase() === selectedTab.channel.toLowerCase() &&
user === serverStore.getNick(server)) {
selectedTab.channel = channel;
selectedTab.name = channel;
this.trigger(selectedTab);
}
},
loadChannels: function(channels) {
if (selectedTab.channel && !_.find(channels, { name: selectedTab.channel })) {
selectedTab.channel = null;