Browse Source

Server field in `Rooms` tab showed MUC supporting clients

JC Brand 7 years ago
parent
commit
3c182b5a26
3 changed files with 13 additions and 8 deletions
  1. 1 0
      CHANGES.md
  2. 2 1
      src/converse-disco.js
  3. 10 7
      src/converse-muc.js

+ 1 - 0
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

+ 2 - 1
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);
                 },
 

+ 10 - 7
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);
                     }
                 }