Controlbox always appears when page loads
This commit is contained in:
JC Brand 2013-04-12 21:56:24 +02:00
parent ebfd092e49
commit d2d10f0661

View File

@ -1011,7 +1011,7 @@
this.localStorage = new Backbone.LocalStorage( this.localStorage = new Backbone.LocalStorage(
hex_sha1('converse.chatboxes-'+xmppchat.bare_jid)); hex_sha1('converse.chatboxes-'+xmppchat.bare_jid));
if (!this.get('controlbox')) { if (!this.get('controlbox')) {
this.create({ this.add({
id: 'controlbox', id: 'controlbox',
box_id: 'controlbox' box_id: 'controlbox'
}); });
@ -1022,11 +1022,11 @@
this.get('controlbox').set({connected:true}); this.get('controlbox').set({connected:true});
// Get cached chatboxes from localstorage // Get cached chatboxes from localstorage
this.fetch({ this.fetch({
add: true, success: add: true,
$.proxy(function (collection, resp) { success: $.proxy(function (collection, resp) {
if (_.include(_.pluck(resp, 'id'), 'controlbox')) { if (_.include(_.pluck(resp, 'id'), 'controlbox')) {
// If the controlbox was saved in localstorage, it must be visible // If the controlbox was saved in localstorage, it must be visible
this.get('controlbox').set({visible:true}); this.get('controlbox').set({visible:true}).save();
} }
}, this) }, this)
}); });