Explorar o código

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

in converse-omemo which relies on `chatbox.occupants` existing in the
`add` handler.
JC Brand %!s(int64=5) %!d(string=hai) anos
pai
achega
4f4b10d2a3
Modificáronse 1 ficheiros con 5 adicións e 7 borrados
  1. 5 7
      src/headless/converse-muc.js

+ 5 - 7
src/headless/converse-muc.js

@@ -351,18 +351,16 @@ converse.plugins.add('converse-muc', {
 
             async initialize () {
                 this.initialized = u.getResolveablePromise();
-
                 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.initOccupants();
+                this.initFeatures(); // sendChatState depends on this.features
                 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()
                 if (!restored) {
                     this.join();