Work on showing auto_joined chatrooms

This commit is contained in:
JC Brand 2018-02-22 11:49:59 +01:00
parent 1ce46a84ae
commit a5513229de
2 changed files with 12 additions and 16 deletions

View File

@ -42,7 +42,7 @@
* *
* NB: These plugins need to have already been loaded via require.js. * NB: These plugins need to have already been loaded via require.js.
*/ */
dependencies: ["converse-chatboxes", "converse-muc"], dependencies: ["converse-chatboxes", "converse-muc", "converse-muc-views"],
overrides: { overrides: {
// Overrides mentioned here will be picked up by converse.js's // Overrides mentioned here will be picked up by converse.js's
@ -269,7 +269,10 @@
openBookmarkedRoom (bookmark) { openBookmarkedRoom (bookmark) {
if (bookmark.get('autojoin')) { if (bookmark.get('autojoin')) {
_converse.api.rooms.create(bookmark.get('jid'), bookmark.get('nick')); const room = _converse.api.rooms.create(bookmark.get('jid'), bookmark.get('nick'));
if (!room.get('hidden')) {
room.trigger('show');
}
} }
return bookmark; return bookmark;
}, },
@ -566,6 +569,8 @@
]).then(initBookmarks) ]).then(initBookmarks)
.catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)); .catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
_converse.on('reconnected', initBookmarks);
_converse.on('connected', () => { _converse.on('connected', () => {
// Add a handler for bookmarks pushed from other connected clients // Add a handler for bookmarks pushed from other connected clients
// (from the same user obviously) // (from the same user obviously)
@ -576,13 +581,6 @@
}, null, 'message', 'headline', null, _converse.bare_jid); }, null, 'message', 'headline', null, _converse.bare_jid);
}); });
const afterReconnection = function () {
if (!_converse.allow_bookmarks) {
return;
}
initBookmarks();
};
_converse.on('reconnected', afterReconnection);
} }
}); });
})); }));

View File

@ -348,13 +348,11 @@
this.el.classList.add("col-xl-2"); this.el.classList.add("col-xl-2");
this.el.classList.add("col-md-3"); this.el.classList.add("col-md-3");
if (!this.controlbox_pane) { this.controlbox_pane = new _converse.ControlBoxPane();
this.controlbox_pane = new _converse.ControlBoxPane(); this.el.querySelector('.controlbox-panes').insertAdjacentElement(
this.el.querySelector('.controlbox-panes').insertAdjacentElement( 'afterBegin',
'afterBegin', this.controlbox_pane.el
this.controlbox_pane.el )
)
}
}, },
close (ev) { close (ev) {