From: Darren Date: Thu, 3 Jul 2014 22:40:17 +0000 (+0100) Subject: Only open 1 query panel per user from userbox X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b0ec0c58144b74619c10a8fd3833ef53b5038b9d;p=KiwiIRC.git Only open 1 query panel per user from userbox --- diff --git a/client/src/views/userbox.js b/client/src/views/userbox.js index 8d21445..8494629 100644 --- a/client/src/views/userbox.js +++ b/client/src/views/userbox.js @@ -44,8 +44,14 @@ _kiwi.view.UserBox = Backbone.View.extend({ }, queryClick: function (event) { - var panel = new _kiwi.model.Query({name: this.user.get('nick')}); - _kiwi.app.connections.active_connection.panels.add(panel); + var nick = this.user.get('nick'), + panel = _kiwi.app.connections.active_connection.panels.getByName(nick); + + if (!panel) { + panel = new _kiwi.model.Query({name: nick}); + _kiwi.app.connections.active_connection.panels.add(panel); + } + panel.view.show(); },