From 93da4e95f2974eecc8fa7b61bd36a42f2a6a10b2 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 28 Apr 2013 15:24:05 +0100 Subject: [PATCH] ControlInput updating nick view properly --- client/assets/dev/view.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.25.1