This commit is contained in:
Baris Usakli
2013-07-22 12:07:05 -04:00
parent 676765278e
commit 52110016c7
4 changed files with 46 additions and 2 deletions

View File

@@ -314,6 +314,32 @@ var RDB = require('./redis.js'),
});
}
Categories.moveRecentReplies = function(tid, oldCid, cid, callback) {
topics.getPids(tid, function(err, pids) {
if(!err) {
function movePost(pid, callback) {
posts.getPostField(pid, 'timestamp', function(timestamp) {
RDB.zrem('categories:recent_posts:cid:' + oldCid, pid);
RDB.zadd('categories:recent_posts:cid:' + cid, timestamp, pid);
});
}
async.each(pids, movePost, function(err) {
if(!err) {
callback(null, 1)
} else {
console.log(err);
callback(err, null);
}
});
} else {
console.log(err);
callback(err, null);
}
});
}
Categories.getCategoryData = function(cid, callback) {
RDB.hgetall('category:' + cid, function(err, data) {
if(err === null)