From c18eaa3351888466a716e81c6f9d57a788053852 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 2 May 2018 16:19:12 +0200 Subject: [PATCH] `pluginsInitialized` is too early we don't yet have a connection then, so listen to `connectionInitialized` instead. --- src/converse-muc.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/converse-muc.js b/src/converse-muc.js index 479db80b4..9fa002561 100644 --- a/src/converse-muc.js +++ b/src/converse-muc.js @@ -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) {