Explorar o código

Only save the session if it's valid.

JC Brand %!s(int64=10) %!d(string=hai) anos
pai
achega
b7c9c0f508
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      converse.js

+ 5 - 1
converse.js

@@ -541,7 +541,11 @@
             this.session.browserStorage = new Backbone.BrowserStorage[converse.storage](id);
             this.session.browserStorage = new Backbone.BrowserStorage[converse.storage](id);
             this.session.fetch();
             this.session.fetch();
             $(window).on('beforeunload', $.proxy(function () {
             $(window).on('beforeunload', $.proxy(function () {
-                this.setSession();
+                if (converse.connection.connected) {
+                    this.setSession();
+                } else {
+                    this.session.browserStorage._clear();
+                }
             }, this));
             }, this));
         };
         };