소스 검색

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

in converse-omemo which relies on `chatbox.occupants` existing in the
`add` handler.
JC Brand 5 년 전
부모
커밋
4f4b10d2a3
1개의 변경된 파일5개의 추가작업 그리고 7개의 파일을 삭제
  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();