Browse Source

muc-views: Wait for messages to be fetched

Also, insert occupants sidebar before inserting the chat into the DOM
JC Brand 5 years ago
parent
commit
f1e1e538b6
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/converse-muc-views.js

+ 2 - 2
src/converse-muc-views.js

@@ -652,7 +652,7 @@ converse.plugins.add('converse-muc-views', {
                 'submit .muc-nickname-form': 'submitNickname'
             },
 
-            initialize () {
+            async initialize () {
                 this.initDebounced();
 
                 this.listenTo(this.model.messages, 'add', this.onMessageAdded);
@@ -679,8 +679,8 @@ converse.plugins.add('converse-muc-views', {
                 this.listenTo(this.model.occupants, 'change:affiliation', this.onOccupantAffiliationChanged);
 
                 this.render();
-                this.updateAfterMessagesFetched();
                 this.createOccupantsView();
+                await this.updateAfterMessagesFetched();
                 this.onConnectionStatusChanged();
                 /**
                  * Triggered once a groupchat has been opened