Improve comments loading performance on long threads

This commit is contained in:
Dan Dascalescu 2015-03-27 15:37:11 -07:00
parent 3f323cd9cb
commit 35010cc245
3 changed files with 4 additions and 3 deletions

View file

@ -1,8 +1,9 @@
## v0.15 “SideScope”
* Improved performance when loading comments for long threads (thanks @dandv!).
* Usernames are now case and space insensitive. `John Smith`, `JohnSmith`, and `johnsmith` are now all considered to be the same username (thanks @splendido!).
* Romanian translation (thanks @razvansky!).
* Now using `feedparser` instead of `htmlparser2` to parse RSS feeds (thanks @delgermurun).
* Now using `feedparser` instead of `htmlparser2` to parse RSS feeds (thanks @delgermurun!).
* Now supporting RSS categories (thanks @delgermurun).
* Added new `postListTop` zone that only appears on post lists.
* Now showing tagline on every post list.

View file

@ -6,7 +6,7 @@ Meteor.publish('singleCommentAndChildren', function(commentId) {
var commentIds = [commentId];
var childCommentIds = _.pluck(Comments.find({parentCommentId: commentId}, {fields: {_id: 1}}).fetch(), '_id');
commentIds = commentIds.concat(childCommentIds);
return Comments.find({_id: {$in: commentIds}});
return Comments.find({_id: {$in: commentIds}}, {sort: {score: -1, postedAt: -1}});
}
return [];
});

View file

@ -47,7 +47,7 @@ Meteor.publish('postUsers', function(postId) {
Meteor.publish('postComments', function(postId) {
if (can.viewById(this.userId)){
return Comments.find({postId: postId});
return Comments.find({postId: postId}, {sort: {score: -1, postedAt: -1}});
}
return [];
});