Save hidden state of singletons if possible

This commit is contained in:
JC Brand 2018-09-06 09:44:44 +02:00
parent 0a5a3b5d07
commit 4903d748d0
2 changed files with 14 additions and 6 deletions

11
dist/converse.js vendored
View File

@ -76740,13 +76740,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
const _converse$env = converse.env, const _converse$env = converse.env,
_ = _converse$env._, _ = _converse$env._,
Strophe = _converse$env.Strophe; Strophe = _converse$env.Strophe;
const u = converse.env.utils;
function hideChat(view) { function hideChat(view) {
if (view.model.get('id') === 'controlbox') { if (view.model.get('id') === 'controlbox') {
return; return;
} }
view.model.save({ u.safeSave(view.model, {
'hidden': true 'hidden': true
}); });
view.hide(); view.hide();
@ -76820,7 +76821,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (_converse.isSingleton()) { if (_converse.isSingleton()) {
_.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat); _.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat);
this.model.set('hidden', false); u.safeSave(this.model, {
'hidden': false
});
} }
return this.__super__._show.apply(this, arguments); return this.__super__._show.apply(this, arguments);
@ -76834,7 +76837,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (_converse.isSingleton()) { if (_converse.isSingleton()) {
_.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat); _.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat);
this.model.set('hidden', false); u.safeSave(this.model, {
'hidden': false
});
} }
return this.__super__.show.apply(this, arguments); return this.__super__.show.apply(this, arguments);

View File

@ -22,13 +22,16 @@
}(this, function (converse) { }(this, function (converse) {
"use strict"; "use strict";
const { _, Strophe } = converse.env; const { _, Strophe } = converse.env;
const u = converse.env.utils;
function hideChat (view) { function hideChat (view) {
if (view.model.get('id') === 'controlbox') { return; } if (view.model.get('id') === 'controlbox') { return; }
view.model.save({'hidden': true}); u.safeSave(view.model, {'hidden': true});
view.hide(); view.hide();
} }
converse.plugins.add('converse-singleton', { converse.plugins.add('converse-singleton', {
// It's possible however to make optional dependencies non-optional. // It's possible however to make optional dependencies non-optional.
// If the setting "strict_plugin_dependencies" is set to true, // If the setting "strict_plugin_dependencies" is set to true,
@ -94,7 +97,7 @@
const { _converse } = this.__super__; const { _converse } = this.__super__;
if (_converse.isSingleton()) { if (_converse.isSingleton()) {
_.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat); _.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat);
this.model.set('hidden', false); u.safeSave(this.model, {'hidden': false});
} }
return this.__super__._show.apply(this, arguments); return this.__super__._show.apply(this, arguments);
} }
@ -105,7 +108,7 @@
const { _converse } = this.__super__; const { _converse } = this.__super__;
if (_converse.isSingleton()) { if (_converse.isSingleton()) {
_.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat); _.each(this.__super__._converse.chatboxviews.xget(this.model.get('id')), hideChat);
this.model.set('hidden', false); u.safeSave(this.model, {'hidden': false});
} }
return this.__super__.show.apply(this, arguments); return this.__super__.show.apply(this, arguments);
} }