Commit 35275c8a authored by JC Brand's avatar JC Brand

Lazily show spinner at the last moment

parent f8bcdad8
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
*/ */
if (this.disable_mam) { return; } if (this.disable_mam) { return; }
const { _converse } = this.__super__; const { _converse } = this.__super__;
this.addSpinner(true);
_converse.api.disco.supports(Strophe.NS.MAM, _converse.bare_jid).then( _converse.api.disco.supports(Strophe.NS.MAM, _converse.bare_jid).then(
(result) => { // Success (result) => { // Success
if (result.supported) { if (result.supported) {
...@@ -92,12 +91,9 @@ ...@@ -92,12 +91,9 @@
}); });
} }
} }
} else {
this.clearSpinner();
} }
}, },
() => { // Error () => { // Error
this.clearSpinner();
_converse.log( _converse.log(
"Error or timeout while checking for MAM support", "Error or timeout while checking for MAM support",
Strophe.LogLevel.ERROR Strophe.LogLevel.ERROR
...@@ -115,19 +111,14 @@ ...@@ -115,19 +111,14 @@
return; return;
} }
const { _converse } = this.__super__; const { _converse } = this.__super__;
this.addSpinner();
_converse.api.disco.supports(Strophe.NS.MAM, _converse.bare_jid).then( _converse.api.disco.supports(Strophe.NS.MAM, _converse.bare_jid).then(
(result) => { // Success (result) => { // Success
if (result.supported) { if (result.supported) {
this.fetchArchivedMessages(); this.fetchArchivedMessages();
} else {
this.clearSpinner();
} }
this.model.save({'mam_initialized': true}); this.model.save({'mam_initialized': true});
}, },
() => { // Error () => { // Error
this.clearSpinner();
_converse.log( _converse.log(
"Error or timeout while checking for MAM support", "Error or timeout while checking for MAM support",
Strophe.LogLevel.ERROR Strophe.LogLevel.ERROR
...@@ -253,9 +244,9 @@ ...@@ -253,9 +244,9 @@
* Then, upon receiving them, call onChatRoomMessage * Then, upon receiving them, call onChatRoomMessage
* so that they are displayed inside it. * so that they are displayed inside it.
*/ */
this.addSpinner();
const that = this; const that = this;
const { _converse } = this.__super__; const { _converse } = this.__super__;
this.addSpinner();
_converse.api.archive.query( _converse.api.archive.query(
_.extend({ _.extend({
'groupchat': true, 'groupchat': true,
......
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