Commit 4f4b10d2 authored by JC Brand's avatar JC Brand

muc: initialize occupants early to avoid timing issues...

in converse-omemo which relies on `chatbox.occupants` existing in the
`add` handler.
parent ff799a41
...@@ -351,18 +351,16 @@ converse.plugins.add('converse-muc', { ...@@ -351,18 +351,16 @@ converse.plugins.add('converse-muc', {
async initialize () { async initialize () {
this.initialized = u.getResolveablePromise(); this.initialized = u.getResolveablePromise();
this.set('box_id', `box-${btoa(this.get('jid'))}`); this.set('box_id', `box-${btoa(this.get('jid'))}`);
await this.restoreSession();
this.initFeatures(); // sendChatState depends on this.features
this.on('change:chat_state', this.sendChatState, this);
this.session.on('change:connection_status', this.onConnectionStatusChanged, this);
this.initMessages(); this.initMessages();
this.initOccupants(); this.initOccupants();
this.initFeatures(); // sendChatState depends on this.features
this.registerHandlers(); this.registerHandlers();
this.on('change:chat_state', this.sendChatState, this);
await this.restoreSession();
this.session.on('change:connection_status', this.onConnectionStatusChanged, this);
const restored = await this.restoreFromCache() const restored = await this.restoreFromCache()
if (!restored) { if (!restored) {
this.join(); this.join();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment