Bugfix. Occupants list not shown after save/cancel of config form

This commit is contained in:
JC Brand 2015-10-31 16:57:36 +00:00
parent dfcebeb621
commit 7a5cd11c3c

View File

@ -2889,18 +2889,19 @@
this.renderToolbar(); this.renderToolbar();
this.$content = this.$el.find('.chat-content'); this.$content = this.$el.find('.chat-content');
} }
// XXX: This is a bit of a hack, to make sure that the this.toggleOccupants(null, true);
// sidebar's state is remembered.
this.model.set({hidden_occupants: !this.model.get('hidden_occupants')});
this.toggleOccupants();
return this; return this;
}, },
toggleOccupants: function (ev) { toggleOccupants: function (ev, preserve_state) {
if (ev) { if (ev) {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
} }
if (preserve_state) {
// Bit of a hack, to make sure that the sidebar's state doesn't change
this.model.set({hidden_occupants: !this.model.get('hidden_occupants')});
}
var $el = this.$('.icon-hide-users'); var $el = this.$('.icon-hide-users');
if (!this.model.get('hidden_occupants')) { if (!this.model.get('hidden_occupants')) {
this.model.save({hidden_occupants: true}); this.model.save({hidden_occupants: true});
@ -3235,7 +3236,7 @@
this.$el.find('div.chatroom-form-container').hide( this.$el.find('div.chatroom-form-container').hide(
function () { function () {
$(this).remove(); $(this).remove();
that.$el.find('.chat-area').show(); that.$el.find('.chat-area').removeClass('hidden');
that.$el.find('.occupants').removeClass('hidden'); that.$el.find('.occupants').removeClass('hidden');
}); });
}, },
@ -3254,7 +3255,7 @@
this.$el.find('div.chatroom-form-container').hide( this.$el.find('div.chatroom-form-container').hide(
function () { function () {
$(this).remove(); $(this).remove();
that.$el.find('.chat-area').show(); that.$el.find('.chat-area').removeClass('hidden');
that.$el.find('.occupants').removeClass('hidden'); that.$el.find('.occupants').removeClass('hidden');
}); });
}, },
@ -3264,7 +3265,7 @@
if (this.$el.find('div.chatroom-form-container').length) { if (this.$el.find('div.chatroom-form-container').length) {
return; return;
} }
this.$('.chatroom-body').children().hide(); this.$('.chatroom-body').children().addClass('hidden');
this.$('.chatroom-body').append(converse.templates.chatroom_form()); this.$('.chatroom-body').append(converse.templates.chatroom_form());
converse.connection.sendIQ( converse.connection.sendIQ(
$iq({ $iq({