From: Darren Date: Sun, 28 Apr 2013 14:24:05 +0000 (+0100) Subject: ControlInput updating nick view properly X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=93da4e95f2974eecc8fa7b61bd36a42f2a6a10b2;p=KiwiIRC.git ControlInput updating nick view properly --- diff --git a/client/assets/dev/view.js b/client/assets/dev/view.js index 7956e72..428ff5a 100644 --- a/client/assets/dev/view.js +++ b/client/assets/dev/view.js @@ -924,9 +924,13 @@ _kiwi.view.ControlBox = Backbone.View.extend({ // Hold tab autocomplete data this.tabcomplete = {active: false, data: [], prefix: ''}; - // When we get any nick change event for any connection, update our view just incase it's us - _kiwi.gateway.bind('onnick', function (event) { - $('.nick', that.$el).text(_kiwi.app.connections.active_connection.get('nick')); + // Keep the nick view updated with nick changes + _kiwi.app.connections.on('change:nick', function(connection) { + // Only update the nick view if it's the active connection + if (connection !== _kiwi.app.connections.active_connection) + return; + + $('.nick', that.$el).text(connection.get('nick')); }); // Update our nick view as we flick between connections