Only close final connection if user meant to
authorResidentBiscuit <jared.ready1@gmail.com>
Wed, 10 Dec 2014 20:13:41 +0000 (14:13 -0600)
committerResidentBiscuit <jared.ready1@gmail.com>
Wed, 10 Dec 2014 20:13:41 +0000 (14:13 -0600)
client/src/views/tabs.js

index 23efb7ff93b505793b449b41f0fed301c86f843b..0c9f60ecda6ffc7b720ecdac1ae2dbb2b6651f53 100644 (file)
@@ -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();