From 3c182b5a26b48432402d4a2535b0be3d65fe5ce2 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 3 Mar 2018 11:45:57 +0100 Subject: [PATCH] Server field in `Rooms` tab showed MUC supporting clients --- CHANGES.md | 1 + src/converse-disco.js | 3 ++- src/converse-muc.js | 17 ++++++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f5425ecc7..a1840be5c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ ### Bugfixes +- Server field in `Rooms` tab showed MUC supporting clients instead of only components. - Avatars weren't being shown. - Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser). - #1022 Status message not sent out on subsequent presences diff --git a/src/converse-disco.js b/src/converse-disco.js index 556a4b12a..72854db6d 100644 --- a/src/converse-disco.js +++ b/src/converse-disco.js @@ -55,7 +55,7 @@ this.features.browserStorage = new Backbone.BrowserStorage[_converse.storage]( b64_sha1(`converse.features-${this.get('jid')}`) ); - this.features.on('add', this.onFeatureAdded); + this.features.on('add', this.onFeatureAdded, this); this.identities = new Backbone.Collection(); this.identities.browserStorage = new Backbone.BrowserStorage[_converse.storage]( @@ -118,6 +118,7 @@ }, onFeatureAdded (feature) { + feature.entity = this; _converse.emit('serviceDiscovered', feature); }, diff --git a/src/converse-muc.js b/src/converse-muc.js index 7d50df5b3..d0c5f83cd 100644 --- a/src/converse-muc.js +++ b/src/converse-muc.js @@ -46,7 +46,7 @@ u, converse, emojione, - fp, + f, tpl_chatarea, tpl_chatroom, tpl_chatroom_disconnect, @@ -2534,6 +2534,7 @@ _converse.MUCJoinForm = Backbone.VDOMView.extend({ + initialize () { this.model.on('change:muc_domain', this.render, this); }, @@ -2604,14 +2605,14 @@ renderTab () { const controlbox = _converse.chatboxes.get('controlbox'); - const chatrooms = fp.filter( + const chatrooms = f.filter( _.partial(u.isOfType, CHATROOMS_TYPE), _converse.chatboxes.models ); this.tab_el.innerHTML = tpl_chatrooms_tab({ 'label_rooms': __('Rooms'), 'is_current': controlbox.get('active-panel') === ROOMS_PANEL_ID, - 'num_unread': fp.sum(fp.map(fp.curry(u.getAttribute)('num_unread'), chatrooms)) + 'num_unread': f.sum(f.map(f.curry(u.getAttribute)('num_unread'), chatrooms)) }); }, @@ -3022,11 +3023,13 @@ function setMUCDomainFromDisco (controlboxview) { /* Check whether service discovery for the user's domain - * returned MUC information and use that to automatically - * set the MUC domain for the "Rooms" panel of the controlbox. - */ + * returned MUC information and use that to automatically + * set the MUC domain for the "Rooms" panel of the controlbox. + */ function featureAdded (feature) { - if ((feature.get('var') === Strophe.NS.MUC)) { + if (feature.get('var') === Strophe.NS.MUC && + f.includes('conference', feature.entity.identities.pluck('category'))) { + setMUCDomain(feature.get('from'), controlboxview); } }