Node.js based forum software built for the modern web
show topics on home instead of replies
barisusakli1e6d5890807d
diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.jsindex a488937dcf..ae6f41fe4c 100644--- a/src/categories/recentreplies.js+++ b/src/categories/recentreplies.js@@ -10,7 +10,7 @@ var async = require('async'),module.exports = function(Categories) {Categories.getRecentReplies = function(cid, uid, count, callback) {- if(!parseInt(count, 10)) {+ if (!parseInt(count, 10)) {return callback(null, []);}@@ -23,6 +23,26 @@ module.exports = function(Categories) {});};+ Categories.getRecentTopicReplies = function(cid, uid, count, callback) {+ if (!parseInt(count, 10)) {+ return callback(null, []);+ }++ db.getSortedSetRevRange('categories:' + cid + ':tid', 0, count - 1, function(err, tids) {+ if (err || !tids || !tids.length) {+ return callback(err, []);+ }++ async.map(tids, topics.getLatestUndeletedPid, function(err, pids) {+ pids = pids.filter(function(pid) {+ return !!pid;+ });++ posts.getPostSummaryByPids(pids, {stripTags: true}, callback);+ });+ });+ };+Categories.moveRecentReplies = function(tid, oldCid, cid) {function movePost(postData, next) {async.parallel([diff --git a/src/controllers/index.js b/src/controllers/index.jsindex b8b4fc3175..81217367a0 100644--- a/src/controllers/index.js+++ b/src/controllers/index.js@@ -70,7 +70,7 @@ Controllers.home = function(req, res, next) {}function getRecentReplies(category, callback) {- categories.getRecentReplies(category.cid, uid, parseInt(category.numRecentReplies, 10), function (err, posts) {+ categories.getRecentTopicReplies(category.cid, uid, parseInt(category.numRecentReplies, 10), function (err, posts) {if (err) {return callback(err);}