converse-controlbox: Fix empty controlbox toggle after disconnect

- Remove apparently unused `giveFeedback` method on ControlBoxView
- Don't show old connection feedback when rendering a new login form.
  Now also no need to explicitly remove feedback after disconnection.
This commit is contained in:
JC Brand 2016-12-04 16:32:32 +00:00
parent 81e3cb976c
commit e179811181
4 changed files with 14 additions and 25 deletions

View File

@ -6,6 +6,7 @@
- Bugfix. Due to changes in `converse-core` the controlbox wasn't aware anymore of
disconnection or reconnection events. [jcbrand]
- Optimize fetching of MAM messages (in some cases happened on each page load). [jcbrand]
- Fix empty controlbox toggle after disconnect. [jcbrand]
## 2.0.3 (2016-11-30)
- #735 Room configuration button not visible. [jcbrand]

View File

@ -265,14 +265,6 @@
return this;
},
giveFeedback: function (message, klass) {
var $el = this.$('.conn-feedback');
$el.addClass('conn-feedback').text(message);
if (klass) {
$el.addClass(klass);
}
},
onConnected: function () {
if (this.model.get('connected')) {
this.render().insertRoster();
@ -287,15 +279,11 @@
},
renderLoginPanel: function () {
var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback.
this.loginpanel = new converse.LoginPanel({
'$parent': this.$el.find('.controlbox-panes'),
'model': this
});
this.loginpanel.render();
if ($feedback.length && $feedback.text() !== __('Connecting')) {
this.$('.conn-feedback').replaceWith($feedback);
}
return this;
},
@ -339,11 +327,7 @@
if (!converse.connection.connected) {
converse.controlboxtoggle.render();
}
converse.controlboxtoggle.show(function () {
if (typeof callback === "function") {
callback();
}
});
converse.controlboxtoggle.show(callback);
return this;
},
@ -717,12 +701,13 @@
initialize: function () {
converse.chatboxviews.$el.prepend(this.render());
this.updateOnlineCount();
var that = this;
converse.on('initialized', function () {
converse.roster.on("add", this.updateOnlineCount, this);
converse.roster.on('change', this.updateOnlineCount, this);
converse.roster.on("destroy", this.updateOnlineCount, this);
converse.roster.on("remove", this.updateOnlineCount, this);
}.bind(this));
converse.roster.on("add", that.updateOnlineCount, that);
converse.roster.on('change', that.updateOnlineCount, that);
converse.roster.on("destroy", that.updateOnlineCount, that);
converse.roster.on("remove", that.updateOnlineCount, that);
});
},
render: function () {

View File

@ -1821,7 +1821,6 @@
}
converse.disconnection_cause = Strophe.Status.AUTHFAIL;
converse.disconnect();
converse.giveFeedback(''); // Wipe the feedback
return;
}
var resource = Strophe.getResourceFromJid(this.jid);

View File

@ -214,12 +214,16 @@
fadeIn: function (el, callback) {
if ($.fx.off) {
el.classList.remove('hidden');
callback();
if (_.isFunction(callback)) {
callback();
}
return;
}
el.addEventListener("animationend", function () {
el.classList.remove('visible');
callback();
if (_.isFunction(callback)) {
callback();
}
}, false);
el.classList.add('visible');
el.classList.remove('hidden');