We do need a validate method, but it needed a fix.

This commit is contained in:
JC Brand 2018-12-13 10:07:07 +01:00
parent 060fd94547
commit 9b61b2bdab
2 changed files with 19 additions and 2 deletions

10
dist/converse.js vendored
View File

@ -50971,9 +50971,15 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
validate(attrs, options) {
const _converse = this.__super__._converse;
if (_converse.view_mode === 'embedded' && attrs.type === _converse.CONTROLBOX_TYPE) {
return 'Controlbox not relevant in embedded view mode';
if (attrs.type === _converse.CONTROLBOX_TYPE) {
if (_converse.view_mode === 'embedded') {
return 'Controlbox not relevant in embedded view mode';
}
return;
}
return this.__super__.validate.apply(this, arguments);
},
initialize() {

View File

@ -145,6 +145,17 @@ converse.plugins.add('converse-controlbox', {
},
ChatBox: {
validate (attrs, options) {
const { _converse } = this.__super__;
if (attrs.type === _converse.CONTROLBOX_TYPE) {
if (_converse.view_mode === 'embedded') {
return 'Controlbox not relevant in embedded view mode';
}
return;
}
return this.__super__.validate.apply(this, arguments);
},
initialize () {
if (this.get('id') === 'controlbox') {
this.set({'time_opened': moment(0).valueOf()});