Commit 0d22f5c3 authored by JC Brand's avatar JC Brand

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

parent c9ecd3cd
......@@ -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));
},
......
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