Commit 8e7dba9b authored by JC Brand's avatar JC Brand

MAM-related bugfixes.

- Don't show another spinner if one already exists.
- last_msg_date's selector was matching chat state notifications.
- Remove the spinner when errback gets called.

updates #306
parent 44abbead
...@@ -1248,7 +1248,9 @@ ...@@ -1248,7 +1248,9 @@
onScroll: function (ev) { onScroll: function (ev) {
if ($(ev.target).scrollTop() === 0 && this.model.messages.length) { if ($(ev.target).scrollTop() === 0 && this.model.messages.length) {
this.$content.prepend('<span class="spinner"/>'); 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'),
...@@ -1298,7 +1300,10 @@ ...@@ -1298,7 +1300,10 @@
} }
} }
}.bind(this), }.bind(this),
_.partial(converse.log, "Error while trying to fetch archived messages", "error") function (iq) {
this.clearSpinner();
converse.log("Error while trying to fetch archived messages", "error");
}.bind(this)
); );
}, },
...@@ -1384,7 +1389,7 @@ ...@@ -1384,7 +1389,7 @@
return; return;
} }
current_msg_date = moment(attrs.time) || moment; current_msg_date = moment(attrs.time) || moment;
last_msg_date = this.$content.children(':last').data('isodate'); last_msg_date = this.$content.children('.chat-message:last').data('isodate');
if (typeof last_msg_date !== "undefined" && (current_msg_date.isAfter(last_msg_date) || current_msg_date.isSame(last_msg_date))) { if (typeof last_msg_date !== "undefined" && (current_msg_date.isAfter(last_msg_date) || current_msg_date.isSame(last_msg_date))) {
// The new message is after the last message // The new message is after the last message
......
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