bookmarks: Don't autojoin rooms prematurely

by first waiting until chatboxes have been fetched as well.
This commit is contained in:
JC Brand 2017-05-07 20:16:13 +02:00
parent d81d62f98d
commit 3835ab7af6
3 changed files with 8 additions and 2 deletions

View File

@ -189,6 +189,7 @@ Converse.js has the following promises:
* rosterGroupsFetched
* rosterInitialized
* statusInitialized
* roomsPanelRendered (only via the `converse-muc` plugin)
Below is an example from `converse-muc.js <https://github.com/jcbrand/converse.js/blob/master/src/converse-muc.js>`_
where the `rosterContactsFetched` promise is waited on. The method

View File

@ -470,7 +470,8 @@
});
_converse.emit('bookmarksInitialized');
};
_converse.on('roomsPanelRendered', initBookmarks);
$.when(_converse.api.waitUntil('chatBoxesFetched'),
_converse.api.waitUntil('roomsPanelRendered')).then(initBookmarks);
var afterReconnection = function () {
if (!_converse.allow_bookmarks) {

View File

@ -319,6 +319,10 @@
},
});
_.extend(_converse.promises, {
'roomsPanelRendered': new $.Deferred()
});
_converse.createChatRoom = function (settings) {
/* Creates a new chat room, making sure that certain attributes
* are correct, for example that the "type" is set to
@ -385,7 +389,7 @@
});
} else {
this.fetchMessages();
_converse.emit('chatRoomOpened', that);
_converse.emit('chatRoomOpened', this);
}
},