Sort comments by date (sort of)

This commit is contained in:
Maximilian Grundke
2017-08-16 18:35:30 +02:00
parent 0326354847
commit 14af5182bf

View File

@ -176,6 +176,9 @@ also, all settings from the rails model needed for the editor configuration in t
while (comments.length > 0 && comments[0].row === clusterRow) { while (comments.length > 0 && comments[0].row === clusterRow) {
cluster.push(comments.shift()); cluster.push(comments.shift());
} }
cluster = cluster.sort(function (a, b) {
return a.id - b.id;
});
var popupContent = ''; var popupContent = '';
cluster.forEach(function(comment) { cluster.forEach(function(comment) {
popupContent += '<p><div class="popover-username">' + comment.username + ':</div>' + popupContent += '<p><div class="popover-username">' + comment.username + ':</div>' +