Commit e1798111 authored by JC Brand's avatar JC Brand

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.
parent 81e3cb97
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
- Bugfix. Due to changes in `converse-core` the controlbox wasn't aware anymore of - Bugfix. Due to changes in `converse-core` the controlbox wasn't aware anymore of
disconnection or reconnection events. [jcbrand] disconnection or reconnection events. [jcbrand]
- Optimize fetching of MAM messages (in some cases happened on each page load). [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) ## 2.0.3 (2016-11-30)
- #735 Room configuration button not visible. [jcbrand] - #735 Room configuration button not visible. [jcbrand]
......
...@@ -265,14 +265,6 @@ ...@@ -265,14 +265,6 @@
return this; return this;
}, },
giveFeedback: function (message, klass) {
var $el = this.$('.conn-feedback');
$el.addClass('conn-feedback').text(message);
if (klass) {
$el.addClass(klass);
}
},
onConnected: function () { onConnected: function () {
if (this.model.get('connected')) { if (this.model.get('connected')) {
this.render().insertRoster(); this.render().insertRoster();
...@@ -287,15 +279,11 @@ ...@@ -287,15 +279,11 @@
}, },
renderLoginPanel: function () { renderLoginPanel: function () {
var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback.
this.loginpanel = new converse.LoginPanel({ this.loginpanel = new converse.LoginPanel({
'$parent': this.$el.find('.controlbox-panes'), '$parent': this.$el.find('.controlbox-panes'),
'model': this 'model': this
}); });
this.loginpanel.render(); this.loginpanel.render();
if ($feedback.length && $feedback.text() !== __('Connecting')) {
this.$('.conn-feedback').replaceWith($feedback);
}
return this; return this;
}, },
...@@ -339,11 +327,7 @@ ...@@ -339,11 +327,7 @@
if (!converse.connection.connected) { if (!converse.connection.connected) {
converse.controlboxtoggle.render(); converse.controlboxtoggle.render();
} }
converse.controlboxtoggle.show(function () { converse.controlboxtoggle.show(callback);
if (typeof callback === "function") {
callback();
}
});
return this; return this;
}, },
...@@ -717,12 +701,13 @@ ...@@ -717,12 +701,13 @@
initialize: function () { initialize: function () {
converse.chatboxviews.$el.prepend(this.render()); converse.chatboxviews.$el.prepend(this.render());
this.updateOnlineCount(); this.updateOnlineCount();
var that = this;
converse.on('initialized', function () { converse.on('initialized', function () {
converse.roster.on("add", this.updateOnlineCount, this); converse.roster.on("add", that.updateOnlineCount, that);
converse.roster.on('change', this.updateOnlineCount, this); converse.roster.on('change', that.updateOnlineCount, that);
converse.roster.on("destroy", this.updateOnlineCount, this); converse.roster.on("destroy", that.updateOnlineCount, that);
converse.roster.on("remove", this.updateOnlineCount, this); converse.roster.on("remove", that.updateOnlineCount, that);
}.bind(this)); });
}, },
render: function () { render: function () {
......
...@@ -1821,7 +1821,6 @@ ...@@ -1821,7 +1821,6 @@
} }
converse.disconnection_cause = Strophe.Status.AUTHFAIL; converse.disconnection_cause = Strophe.Status.AUTHFAIL;
converse.disconnect(); converse.disconnect();
converse.giveFeedback(''); // Wipe the feedback
return; return;
} }
var resource = Strophe.getResourceFromJid(this.jid); var resource = Strophe.getResourceFromJid(this.jid);
......
...@@ -214,12 +214,16 @@ ...@@ -214,12 +214,16 @@
fadeIn: function (el, callback) { fadeIn: function (el, callback) {
if ($.fx.off) { if ($.fx.off) {
el.classList.remove('hidden'); el.classList.remove('hidden');
callback(); if (_.isFunction(callback)) {
callback();
}
return; return;
} }
el.addEventListener("animationend", function () { el.addEventListener("animationend", function () {
el.classList.remove('visible'); el.classList.remove('visible');
callback(); if (_.isFunction(callback)) {
callback();
}
}, false); }, false);
el.classList.add('visible'); el.classList.add('visible');
el.classList.remove('hidden'); el.classList.remove('hidden');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment