pluginsInitialized is too early

we don't yet have a connection then, so listen to
`connectionInitialized` instead.
This commit is contained in:
JC Brand 2018-05-02 16:19:12 +02:00
parent a52e24adc8
commit c18eaa3351

View File

@ -1127,13 +1127,16 @@
}
/************************ BEGIN Event Handlers ************************/
_converse.api.listen.on('pluginsInitialized', () => {
_converse.avatars = new _converse.Avatars();
_converse.avatars.browserStorage = new Backbone.BrowserStorage.local(
b64_sha1(`converse.avatars-${_converse.bare_jid}`)
);
_converse.avatars.fetch({'silent': true});
});
_converse.initAvatars = function () {
if (_.isUndefined(_converse.avatars)) {
_converse.avatars = new _converse.Avatars();
_converse.avatars.browserStorage = new Backbone.BrowserStorage.local(
b64_sha1(`converse.avatars-${_converse.bare_jid}`)
);
_converse.avatars.fetch();
}
}
_converse.api.listen.on('connectionInitialized', () => _converse.initAvatars);
_converse.on('addClientFeatures', () => {
if (_converse.allow_muc) {