Merge branch 'master' of github.com:designcreateplay/NodeBB

Conflicts:
	src/topics.js
v1.18.x
Julian Lam 12 years ago
commit 743e0569c1

@ -189,7 +189,6 @@ var RDB = require('./redis.js'),
--topicCountToLoad; --topicCountToLoad;
if(retrieved_topics.length === topicCountToLoad) { if(retrieved_topics.length === topicCountToLoad) {
console.log('derp');
callback(retrieved_topics); callback(retrieved_topics);
} }
}); });
@ -282,13 +281,17 @@ var RDB = require('./redis.js'),
} }
Categories.getRecentReplies = function(cid, count, callback) { Categories.getRecentReplies = function(cid, count, callback) {
RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, count-1, function(err, pids) { RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, (count<10)?10:count, function(err, pids) {
if (pids.length == 0) { if (pids.length == 0) {
callback([]); callback([]);
return; return;
} }
posts.getPostSummaryByPids(pids, function(posts) { posts.getPostSummaryByPids(pids, function(posts) {
if(posts.length > count) {
posts = posts.slice(0, count);
}
callback(posts); callback(posts);
}); });
}); });

@ -57,24 +57,24 @@ marked.setOptions({
var returnData = []; var returnData = [];
var loaded = 0; function getPostSummary(pid, callback) {
Posts.getPostFields(pid, ['pid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
for(var i=0, ii=pids.length; i<ii; ++i) { Posts.addUserInfoToPost(postData, function() {
(function(index, pid) { if(postData.deleted !== '1') {
Posts.getPostFields(pids[i], ['pid', 'content', 'uid', 'timestamp'], function(postData) { returnData.push(postData);
Posts.addUserInfoToPost(postData, function() { }
returnData[index] = postData; callback(null);
++loaded;
if(loaded === pids.length) {
callback(returnData);
}
});
}); });
}(i, pids[i])); });
} }
async.eachSeries(pids, getPostSummary, function(err) {
if(!err) {
callback(returnData);
}
});
}; };
Posts.getPostData = function(pid, callback) { Posts.getPostData = function(pid, callback) {

@ -61,7 +61,7 @@ var user = require('./../user.js'),
}); });
app.get('/users/:userslug/edit', function(req, res) { app.get('/users/:userslug/edit', function(req, res) {
console.log('derp');
if(!req.user) if(!req.user)
return res.redirect('/403'); return res.redirect('/403');

@ -263,7 +263,6 @@ var express = require('express'),
app.get('/test', function(req, res) { app.get('/test', function(req, res) {
console.log('derp');
/*user.get_userslugs_by_uids([1,2], function(data) { /*user.get_userslugs_by_uids([1,2], function(data) {
res.send(data); res.send(data);
});*/ });*/

Loading…
Cancel
Save