From 7a5cd11c3c3077f3f9ed67bbad8df0c0565d82fd Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 31 Oct 2015 16:57:36 +0000 Subject: [PATCH] Bugfix. Occupants list not shown after save/cancel of config form --- converse.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/converse.js b/converse.js index 16e3b5052..e1a5dabdb 100644 --- a/converse.js +++ b/converse.js @@ -2889,18 +2889,19 @@ this.renderToolbar(); this.$content = this.$el.find('.chat-content'); } - // XXX: This is a bit of a hack, to make sure that the - // sidebar's state is remembered. - this.model.set({hidden_occupants: !this.model.get('hidden_occupants')}); - this.toggleOccupants(); + this.toggleOccupants(null, true); return this; }, - toggleOccupants: function (ev) { + toggleOccupants: function (ev, preserve_state) { if (ev) { ev.preventDefault(); 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'); if (!this.model.get('hidden_occupants')) { this.model.save({hidden_occupants: true}); @@ -3235,7 +3236,7 @@ this.$el.find('div.chatroom-form-container').hide( function () { $(this).remove(); - that.$el.find('.chat-area').show(); + that.$el.find('.chat-area').removeClass('hidden'); that.$el.find('.occupants').removeClass('hidden'); }); }, @@ -3254,7 +3255,7 @@ this.$el.find('div.chatroom-form-container').hide( function () { $(this).remove(); - that.$el.find('.chat-area').show(); + that.$el.find('.chat-area').removeClass('hidden'); that.$el.find('.occupants').removeClass('hidden'); }); }, @@ -3264,7 +3265,7 @@ if (this.$el.find('div.chatroom-form-container').length) { return; } - this.$('.chatroom-body').children().hide(); + this.$('.chatroom-body').children().addClass('hidden'); this.$('.chatroom-body').append(converse.templates.chatroom_form()); converse.connection.sendIQ( $iq({