Fixes #912 maximize
method in converse-minimize
fails...
if the `controlbox` is not there. Also, make `converse-controlbox` and `converse-muc` optional dependencies of `converse-minimize`.
This commit is contained in:
parent
734991f1ce
commit
b9b9689668
@ -8,6 +8,7 @@
|
||||
- #908 Login form for inVerse is only 200px when `allow_registration` is set to `false`.
|
||||
- #909 Translations written as template literals [aren't parsed properly by xgettext](https://savannah.gnu.org/bugs/?50920).
|
||||
- #911 Use `getDefaultNickName` consistently to allow better overrides via plugins.
|
||||
- #912 `maximize` method in `converse-minimize` fails if the `controlbox` is not there.
|
||||
|
||||
## 3.2.0 (2017-08-09)
|
||||
|
||||
|
@ -305,8 +305,9 @@
|
||||
},
|
||||
|
||||
insertIntoDOM () {
|
||||
/* This method gets overridden in src/converse-controlbox.js if
|
||||
* the controlbox plugin is active.
|
||||
/* This method gets overridden in src/converse-controlbox.js
|
||||
* as well as src/converse-muc.js (if those plugins are
|
||||
* enabled).
|
||||
*/
|
||||
const container = document.querySelector('#conversejs');
|
||||
if (this.el.parentNode !== container) {
|
||||
|
@ -159,8 +159,12 @@
|
||||
|
||||
ChatBoxView: {
|
||||
insertIntoDOM () {
|
||||
const { _converse } = this.__super__;
|
||||
this.$el.insertAfter(_converse.chatboxviews.get("controlbox").$el);
|
||||
const view = this.__super__._converse.chatboxviews.get("controlbox");
|
||||
if (view) {
|
||||
view.el.insertAdjacentElement('afterend', this.el)
|
||||
} else {
|
||||
this.__super__.insertIntoDOM.apply(this, arguments);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -204,8 +208,10 @@
|
||||
},
|
||||
|
||||
initialize () {
|
||||
_converse.controlboxtoggle = new _converse.ControlBoxToggle();
|
||||
this.$el.insertAfter(_converse.controlboxtoggle.$el);
|
||||
if (_.isUndefined(_converse.controlboxtoggle)) {
|
||||
_converse.controlboxtoggle = new _converse.ControlBoxToggle();
|
||||
this.$el.insertAfter(_converse.controlboxtoggle.$el);
|
||||
}
|
||||
this.model.on('change:connected', this.onConnected, this);
|
||||
this.model.on('destroy', this.hide, this);
|
||||
this.model.on('hide', this.hide, this);
|
||||
|
@ -13,9 +13,7 @@
|
||||
"tpl!toggle_chats",
|
||||
"tpl!trimmed_chat",
|
||||
"tpl!chats_panel",
|
||||
"converse-chatview",
|
||||
"converse-controlbox",
|
||||
"converse-muc"
|
||||
"converse-chatview"
|
||||
], factory);
|
||||
}(this, function (
|
||||
$,
|
||||
@ -30,6 +28,20 @@
|
||||
const { _ , utils, Backbone, Promise, Strophe, b64_sha1, moment } = converse.env;
|
||||
|
||||
converse.plugins.add('converse-minimize', {
|
||||
/* Optional dependencies are other plugins which might be
|
||||
* overridden or relied upon, and therefore need to be loaded before
|
||||
* this plugin. They are called "optional" because they might not be
|
||||
* available, in which case any overrides applicable to them will be
|
||||
* ignored.
|
||||
*
|
||||
* It's possible however to make optional dependencies non-optional.
|
||||
* If the setting "strict_plugin_dependencies" is set to true,
|
||||
* an error will be raised if the plugin is not found.
|
||||
*
|
||||
* NB: These plugins need to have already been loaded via require.js.
|
||||
*/
|
||||
optional_dependencies: ["converse-controlbox", "converse-muc"],
|
||||
|
||||
overrides: {
|
||||
// Overrides mentioned here will be picked up by converse.js's
|
||||
// plugin architecture they will replace existing methods on the
|
||||
@ -127,12 +139,13 @@
|
||||
maximize () {
|
||||
// Restores a minimized chat box
|
||||
const { _converse } = this.__super__;
|
||||
this.$el.insertAfter(_converse.chatboxviews.get("controlbox").$el);
|
||||
this.insertIntoDOM();
|
||||
|
||||
if (!this.model.isScrolledUp()) {
|
||||
this.model.clearUnreadMsgCounter();
|
||||
}
|
||||
this.show();
|
||||
_converse.emit('chatBoxMaximized', this);
|
||||
this.__super__._converse.emit('chatBoxMaximized', this);
|
||||
return this;
|
||||
},
|
||||
|
||||
@ -177,11 +190,12 @@
|
||||
const html = this.__super__.generateHeadingHTML.apply(this, arguments);
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = html;
|
||||
const el = tpl_chatbox_minimize(
|
||||
{info_minimize: __('Minimize this chat box')}
|
||||
);
|
||||
const button = div.querySelector('.close-chatbox-button');
|
||||
button.insertAdjacentHTML('afterend', el);
|
||||
button.insertAdjacentHTML('afterend',
|
||||
tpl_chatbox_minimize({
|
||||
'info_minimize': __('Minimize this chat box')
|
||||
})
|
||||
);
|
||||
return div.innerHTML;
|
||||
}
|
||||
},
|
||||
|
@ -525,19 +525,6 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
insertIntoDOM () {
|
||||
if (document.querySelector('body').contains(this.el)) {
|
||||
return;
|
||||
}
|
||||
const view = _converse.chatboxviews.get("controlbox");
|
||||
if (view) {
|
||||
this.$el.insertAfter(view.$el);
|
||||
} else {
|
||||
$('#conversejs').prepend(this.$el);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
generateHeadingHTML () {
|
||||
/* Returns the heading HTML to be rendered.
|
||||
*/
|
||||
|
@ -71,7 +71,7 @@
|
||||
};
|
||||
|
||||
_converse.onVCardError = function (jid, iq, errback) {
|
||||
const contact = _converse.roster.get(jid);
|
||||
const contact = _.get(_converse.roster, jid);
|
||||
if (contact) {
|
||||
contact.save({ 'vcard_updated': moment().format() });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user