Server field in Rooms tab showed MUC supporting clients

This commit is contained in:
JC Brand 2018-03-03 11:45:57 +01:00
parent c4c154cfa1
commit 3c182b5a26
3 changed files with 13 additions and 8 deletions

View File

@ -7,6 +7,7 @@
### Bugfixes ### Bugfixes
- Server field in `Rooms` tab showed MUC supporting clients instead of only components.
- Avatars weren't being shown. - 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). - 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 - #1022 Status message not sent out on subsequent presences

View File

@ -55,7 +55,7 @@
this.features.browserStorage = new Backbone.BrowserStorage[_converse.storage]( this.features.browserStorage = new Backbone.BrowserStorage[_converse.storage](
b64_sha1(`converse.features-${this.get('jid')}`) 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 = new Backbone.Collection();
this.identities.browserStorage = new Backbone.BrowserStorage[_converse.storage]( this.identities.browserStorage = new Backbone.BrowserStorage[_converse.storage](
@ -118,6 +118,7 @@
}, },
onFeatureAdded (feature) { onFeatureAdded (feature) {
feature.entity = this;
_converse.emit('serviceDiscovered', feature); _converse.emit('serviceDiscovered', feature);
}, },

View File

@ -46,7 +46,7 @@
u, u,
converse, converse,
emojione, emojione,
fp, f,
tpl_chatarea, tpl_chatarea,
tpl_chatroom, tpl_chatroom,
tpl_chatroom_disconnect, tpl_chatroom_disconnect,
@ -2534,6 +2534,7 @@
_converse.MUCJoinForm = Backbone.VDOMView.extend({ _converse.MUCJoinForm = Backbone.VDOMView.extend({
initialize () { initialize () {
this.model.on('change:muc_domain', this.render, this); this.model.on('change:muc_domain', this.render, this);
}, },
@ -2604,14 +2605,14 @@
renderTab () { renderTab () {
const controlbox = _converse.chatboxes.get('controlbox'); const controlbox = _converse.chatboxes.get('controlbox');
const chatrooms = fp.filter( const chatrooms = f.filter(
_.partial(u.isOfType, CHATROOMS_TYPE), _.partial(u.isOfType, CHATROOMS_TYPE),
_converse.chatboxes.models _converse.chatboxes.models
); );
this.tab_el.innerHTML = tpl_chatrooms_tab({ this.tab_el.innerHTML = tpl_chatrooms_tab({
'label_rooms': __('Rooms'), 'label_rooms': __('Rooms'),
'is_current': controlbox.get('active-panel') === ROOMS_PANEL_ID, '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) { function setMUCDomainFromDisco (controlboxview) {
/* Check whether service discovery for the user's domain /* Check whether service discovery for the user's domain
* returned MUC information and use that to automatically * returned MUC information and use that to automatically
* set the MUC domain for the "Rooms" panel of the controlbox. * set the MUC domain for the "Rooms" panel of the controlbox.
*/ */
function featureAdded (feature) { 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); setMUCDomain(feature.get('from'), controlboxview);
} }
} }