parent
ec02d34af9
commit
1a7a5e8054
15
converse.js
15
converse.js
|
@ -1281,6 +1281,7 @@
|
||||||
if ($(ev.target).scrollTop() === 0) {
|
if ($(ev.target).scrollTop() === 0) {
|
||||||
oldest = this.model.messages.where({'time': this.model.messages.pluck('time').sort()[0]});
|
oldest = this.model.messages.where({'time': this.model.messages.pluck('time').sort()[0]});
|
||||||
if (oldest) {
|
if (oldest) {
|
||||||
|
this.$el.find('.chat-content').prepend('<span class="spinner"/>');
|
||||||
this.fetchArchivedMessages({
|
this.fetchArchivedMessages({
|
||||||
'before': oldest[0].get('archive_id'),
|
'before': oldest[0].get('archive_id'),
|
||||||
'with': this.model.get('jid'),
|
'with': this.model.get('jid'),
|
||||||
|
@ -1343,7 +1344,12 @@
|
||||||
* so that they are displayed inside it.
|
* so that they are displayed inside it.
|
||||||
*/
|
*/
|
||||||
API.archive.query(options,
|
API.archive.query(options,
|
||||||
_.partial(_.map, _, converse.chatboxes.onMessage.bind(converse.chatboxes)),
|
function (messages) {
|
||||||
|
this.clearSpinner();
|
||||||
|
if (messages.length) {
|
||||||
|
_.map(messages, converse.chatboxes.onMessage.bind(converse.chatboxes));
|
||||||
|
}
|
||||||
|
}.bind(this),
|
||||||
_.partial(converse.log, "Error while trying to fetch archived messages", "error")
|
_.partial(converse.log, "Error while trying to fetch archived messages", "error")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -1379,6 +1385,13 @@
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearSpinner: function () {
|
||||||
|
var $content = this.$el.find('.chat-content');
|
||||||
|
if ($content.children(':first').is('span.spinner')) {
|
||||||
|
$content.children(':first').first().remove();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
showMessage: function (msg_dict) {
|
showMessage: function (msg_dict) {
|
||||||
var $content = this.$el.find('.chat-content'),
|
var $content = this.$el.find('.chat-content'),
|
||||||
msg_time = moment(msg_dict.time) || moment,
|
msg_time = moment(msg_dict.time) || moment,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user