2
0
Эх сурвалжийг харах

Bugfix. Make sure that `restoreBOSHSession` is always called

I.e. also when we're reconnecting.

Otherwise the `_converse.bosh_session` object doesn't get recreated and
we don't cache the BOSH tokens.
JC Brand 6 жил өмнө
parent
commit
f9cc51b28a

+ 4 - 6
src/headless/converse-core.js

@@ -498,7 +498,7 @@ function reconnect () {
 
     _converse.connection.reconnecting = true;
     tearDown();
-    return _converse.api.user.login(null, null, true);
+    return _converse.api.user.login();
 }
 
 const debouncedReconnect = _.debounce(reconnect, 2000);
@@ -1488,14 +1488,12 @@ _converse.api = {
          * @method _converse.api.user.login
          * @param {string} [jid]
          * @param {string} [password]
-         * @param {boolean} [reconnecting]
          */
-        async login (jid, password, reconnecting) {
+        async login (jid, password) {
             if (_converse.api.connection.isType('bosh')) {
-                const uses_prebind = (_converse.authentication === _converse.PREBIND && _converse.prebind_url);
-                if (!reconnecting && await _converse.restoreBOSHSession()) {
+                if (await _converse.restoreBOSHSession()) {
                     return;
-                } else if (reconnecting && uses_prebind) {
+                } else if (_converse.authentication === _converse.PREBIND) {
                     return _converse.startNewBOSHSession();
                 }
             } else if (_converse.authentication === _converse.PREBIND) {