Commit 7d1fc391 authored by JC Brand's avatar JC Brand

Don't attempt to fetch archived messages if not supported

by the server. Otherwise we get a spinner that doesn't disappear.
parent 57a30917
...@@ -1250,9 +1250,6 @@ ...@@ -1250,9 +1250,6 @@
onScroll: function (ev) { onScroll: function (ev) {
if ($(ev.target).scrollTop() === 0 && this.model.messages.length) { if ($(ev.target).scrollTop() === 0 && this.model.messages.length) {
if (!this.$content.first().hasClass('spinner')) {
this.$content.prepend('<span class="spinner"/>');
}
this.fetchArchivedMessages({ this.fetchArchivedMessages({
'before': this.model.messages.at(0).get('archive_id'), 'before': this.model.messages.at(0).get('archive_id'),
'with': this.model.get('jid'), 'with': this.model.get('jid'),
...@@ -1291,6 +1288,11 @@ ...@@ -1291,6 +1288,11 @@
* Then, upon receiving them, call onMessage on the chat box, * Then, upon receiving them, call onMessage on the chat box,
* so that they are displayed inside it. * so that they are displayed inside it.
*/ */
if (!converse.features.findWhere({'var': Strophe.NS.MAM})) {
converse.log("Attempted to fetch archived messages but this user's server doesn't support XEP-0313");
return;
}
this.addSpinner();
API.archive.query(_.extend(options, {'groupchat': this.is_chatroom}), API.archive.query(_.extend(options, {'groupchat': this.is_chatroom}),
function (messages) { function (messages) {
this.clearSpinner(); this.clearSpinner();
...@@ -1347,6 +1349,12 @@ ...@@ -1347,6 +1349,12 @@
return this; return this;
}, },
addSpinner: function () {
if (!this.$content.first().hasClass('spinner')) {
this.$content.prepend('<span class="spinner"/>');
}
},
clearSpinner: function () { clearSpinner: function () {
if (this.$content.children(':first').is('span.spinner')) { if (this.$content.children(':first').is('span.spinner')) {
this.$content.children(':first').remove(); this.$content.children(':first').remove();
......
...@@ -8,6 +8,7 @@ Changelog ...@@ -8,6 +8,7 @@ Changelog
* #468 Fix [object Object] being sometimes shown as status [1st8] * #468 Fix [object Object] being sometimes shown as status [1st8]
* #493 Roster wasn't being updated after a Roster push update [teseo, jcbrand] * #493 Roster wasn't being updated after a Roster push update [teseo, jcbrand]
* #496 Bugfix. Pings weren't being sent out. [teseo, jcbrand] * #496 Bugfix. Pings weren't being sent out. [teseo, jcbrand]
* Bugfix. Spinner doesn't disappear when scrolling up (when server doesn't support XEP-0313). [jcbrand]
0.9.5 (2015-08-24) 0.9.5 (2015-08-24)
------------------ ------------------
......
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