Commit e362776b authored by JC Brand's avatar JC Brand

converse-muc-views: Don't prematurely insert MUC into the DOM

parent d86a657a
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
expect(room instanceof Backbone.Model).toBeTruthy(); expect(room instanceof Backbone.Model).toBeTruthy();
chatroomview = _converse.chatboxviews.get(jid); chatroomview = _converse.chatboxviews.get(jid);
expect(chatroomview.is_chatroom).toBeTruthy(); expect(chatroomview.is_chatroom).toBeTruthy();
expect(u.isVisible(chatroomview.el)).toBeTruthy(); await test_utils.waitUntil(() => u.isVisible(chatroomview.el));
// Test again, now that the room exists. // Test again, now that the room exists.
room = await _converse.api.rooms.open(jid); room = await _converse.api.rooms.open(jid);
...@@ -129,19 +129,19 @@ ...@@ -129,19 +129,19 @@
room = await _converse.api.rooms.open(jid); room = await _converse.api.rooms.open(jid);
expect(room instanceof Backbone.Model).toBeTruthy(); expect(room instanceof Backbone.Model).toBeTruthy();
chatroomview = _converse.chatboxviews.get(jid.toLowerCase()); chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
expect(u.isVisible(chatroomview.el)).toBeTruthy(); await test_utils.waitUntil(() => u.isVisible(chatroomview.el));
jid = 'leisure@localhost'; jid = 'leisure@localhost';
room = await _converse.api.rooms.open(jid); room = await _converse.api.rooms.open(jid);
expect(room instanceof Backbone.Model).toBeTruthy(); expect(room instanceof Backbone.Model).toBeTruthy();
chatroomview = _converse.chatboxviews.get(jid.toLowerCase()); chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
expect(u.isVisible(chatroomview.el)).toBeTruthy(); await test_utils.waitUntil(() => u.isVisible(chatroomview.el));
jid = 'leiSure@localhost'; jid = 'leiSure@localhost';
room = await _converse.api.rooms.open(jid); room = await _converse.api.rooms.open(jid);
expect(room instanceof Backbone.Model).toBeTruthy(); expect(room instanceof Backbone.Model).toBeTruthy();
chatroomview = _converse.chatboxviews.get(jid.toLowerCase()); chatroomview = _converse.chatboxviews.get(jid.toLowerCase());
expect(u.isVisible(chatroomview.el)).toBeTruthy(); await test_utils.waitUntil(() => u.isVisible(chatroomview.el));
chatroomview.close(); chatroomview.close();
_converse.muc_instant_rooms = false; _converse.muc_instant_rooms = false;
...@@ -1286,6 +1286,7 @@ ...@@ -1286,6 +1286,7 @@
await _converse.api.rooms.open('coven@chat.shakespeare.lit', {'nick': 'some1'}); await _converse.api.rooms.open('coven@chat.shakespeare.lit', {'nick': 'some1'});
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
await test_utils.waitUntil(() => u.isVisible(view.el));
spyOn(view.model, 'saveAffiliationAndRole').and.callThrough(); spyOn(view.model, 'saveAffiliationAndRole').and.callThrough();
// We pretend this is a new room, so no disco info is returned. // We pretend this is a new room, so no disco info is returned.
const features_stanza = $iq({ const features_stanza = $iq({
...@@ -1305,7 +1306,7 @@ ...@@ -1305,7 +1306,7 @@
* </x> * </x>
* </presence></body> * </presence></body>
*/ */
var presence = $pres({ const presence = $pres({
to: 'dummy@localhost/_converse.js-29092160', to: 'dummy@localhost/_converse.js-29092160',
from: 'coven@chat.shakespeare.lit/some1' from: 'coven@chat.shakespeare.lit/some1'
}).c('x', {xmlns: Strophe.NS.MUC_USER}) }).c('x', {xmlns: Strophe.NS.MUC_USER})
......
...@@ -581,7 +581,6 @@ converse.plugins.add('converse-muc-views', { ...@@ -581,7 +581,6 @@ converse.plugins.add('converse-muc-views', {
this.render(); this.render();
this.updateAfterMessagesFetched(); this.updateAfterMessagesFetched();
this.createOccupantsView(); this.createOccupantsView();
this.insertIntoDOM();
this.registerHandlers(); this.registerHandlers();
/** /**
* Triggered once a groupchat has been opened * Triggered once a groupchat has been opened
......
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