Bugfix. Make sure to only append after a single message.

This commit is contained in:
JC Brand 2017-06-14 18:59:39 +02:00
parent c9ecd3cd4d
commit 0d22f5c33c

View File

@ -253,7 +253,7 @@
* (Object) attrs: An object containing the message
* attributes.
*/
var msg_dates, idx,
var msg_dates,
$first_msg = this.$content.find('.chat-message:first'),
first_msg_date = $first_msg.data('isodate'),
current_msg_date = moment(attrs.time) || moment,
@ -297,13 +297,12 @@
});
msg_dates.push(current_msg_date);
msg_dates.sort();
idx = msg_dates.indexOf(current_msg_date)-1;
var idx = msg_dates.indexOf(current_msg_date)-1;
var $latest_message = this.$content.find('.chat-message[data-isodate="'+msg_dates[idx]+'"]:last');
_.flow(
function ($el) {
$el.insertAfter(
this.$content.find('.chat-message[data-isodate="'+msg_dates[idx]+'"]'));
return $el;
}.bind(this),
$el.insertAfter($latest_message);
},
this.scrollDown.bind(this)
)(this.renderMessage(attrs));
},