From 09e38d19767b034ef464a6514e624e2abe3498ec Mon Sep 17 00:00:00 2001 From: ResidentBiscuit Date: Wed, 10 Dec 2014 14:13:41 -0600 Subject: [PATCH] Only close final connection if user meant to --- client/src/views/tabs.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/src/views/tabs.js b/client/src/views/tabs.js index 23efb7f..0c9f60e 100644 --- a/client/src/views/tabs.js +++ b/client/src/views/tabs.js @@ -134,10 +134,16 @@ _kiwi.view.Tabs = Backbone.View.extend({ if (panel.isChannel() && panel.get('members').models.length > 0) { this.model.network.gateway.part(panel.get('name')); } else if(panel.isServer()) { - this.model.network.gateway.quit("Leaving"); - _kiwi.app.connections.remove(this.model.network); - if(_kiwi.app.connections.length < 1) { - window.location.reload(true); + if(_kiwi.app.connections.length < 2) { + var confirmed = confirm("Closing your final connection will redirect you back to the homepage. Is this OK?"); + if(confirmed) { + this.model.network.gateway.quit("Leaving"); + _kiwi.app.connections.remove(this.model.network); + window.location.reload(true); + } + } else { + this.model.network.gateway.quit("Leaving"); + _kiwi.app.connections.remove(this.model.network); } } else { panel.close(); -- 2.25.1