@@ -59,10 +59,10 @@ exports.index = function (req, res, next) {
5959 var topic_ids = replies . map ( function ( reply ) {
6060 return reply . topic_id . toString ( )
6161 } )
62- topic_ids = _ . uniq ( topic_ids ) ;
62+ topic_ids = _ . uniq ( topic_ids ) . slice ( 0 , 5 ) ; // 只显示最近5条
6363
6464 var query = { _id : { '$in' : topic_ids } } ;
65- var opt = { limit : 5 , sort : '-create_at' } ;
65+ var opt = { } ;
6666 Topic . getTopicsByQuery ( query , opt , proxy . done ( 'recent_replies' , function ( recent_replies ) {
6767 recent_replies = _ . sortBy ( recent_replies , function ( topic ) {
6868 return topic_ids . indexOf ( topic . _id . toString ( ) )
@@ -311,9 +311,10 @@ exports.listReplies = function (req, res, next) {
311311 Reply . getRepliesByAuthorId ( user . _id , opt , proxy . done ( function ( replies ) {
312312 // 获取所有有评论的主题
313313 var topic_ids = replies . map ( function ( reply ) {
314- return reply . topic_id ;
314+ return reply . topic_id . toString ( ) ;
315315 } ) ;
316316 topic_ids = _ . uniq ( topic_ids ) ;
317+
317318 var query = { '_id' : { '$in' : topic_ids } } ;
318319 Topic . getTopicsByQuery ( query , { } , proxy . done ( 'topics' , function ( topics ) {
319320 topics = _ . sortBy ( topics , function ( topic ) {
0 commit comments