mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-09 04:36:26 +02:00
Merge branch 'master' of github.com:designcreateplay/NodeBB
Conflicts: src/topics.js
This commit is contained in:
@@ -189,7 +189,6 @@ var RDB = require('./redis.js'),
|
||||
--topicCountToLoad;
|
||||
|
||||
if(retrieved_topics.length === topicCountToLoad) {
|
||||
console.log('derp');
|
||||
callback(retrieved_topics);
|
||||
}
|
||||
});
|
||||
@@ -282,13 +281,17 @@ var RDB = require('./redis.js'),
|
||||
}
|
||||
|
||||
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) {
|
||||
callback([]);
|
||||
return;
|
||||
}
|
||||
|
||||
posts.getPostSummaryByPids(pids, function(posts) {
|
||||
if(posts.length > count) {
|
||||
posts = posts.slice(0, count);
|
||||
}
|
||||
callback(posts);
|
||||
});
|
||||
});
|
||||
|
||||
32
src/posts.js
32
src/posts.js
@@ -57,24 +57,24 @@ marked.setOptions({
|
||||
|
||||
var returnData = [];
|
||||
|
||||
var loaded = 0;
|
||||
|
||||
for(var i=0, ii=pids.length; i<ii; ++i) {
|
||||
|
||||
(function(index, pid) {
|
||||
Posts.getPostFields(pids[i], ['pid', 'content', 'uid', 'timestamp'], function(postData) {
|
||||
Posts.addUserInfoToPost(postData, function() {
|
||||
|
||||
returnData[index] = postData;
|
||||
++loaded;
|
||||
|
||||
if(loaded === pids.length) {
|
||||
callback(returnData);
|
||||
}
|
||||
});
|
||||
function getPostSummary(pid, callback) {
|
||||
Posts.getPostFields(pid, ['pid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
|
||||
Posts.addUserInfoToPost(postData, function() {
|
||||
|
||||
if(postData.deleted !== '1') {
|
||||
returnData.push(postData);
|
||||
}
|
||||
|
||||
callback(null);
|
||||
});
|
||||
}(i, pids[i]));
|
||||
});
|
||||
}
|
||||
|
||||
async.eachSeries(pids, getPostSummary, function(err) {
|
||||
if(!err) {
|
||||
callback(returnData);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Posts.getPostData = function(pid, callback) {
|
||||
|
||||
@@ -61,7 +61,7 @@ var user = require('./../user.js'),
|
||||
});
|
||||
|
||||
app.get('/users/:userslug/edit', function(req, res) {
|
||||
console.log('derp');
|
||||
|
||||
if(!req.user)
|
||||
return res.redirect('/403');
|
||||
|
||||
|
||||
@@ -263,7 +263,6 @@ var express = require('express'),
|
||||
|
||||
app.get('/test', function(req, res) {
|
||||
|
||||
console.log('derp');
|
||||
/*user.get_userslugs_by_uids([1,2], function(data) {
|
||||
res.send(data);
|
||||
});*/
|
||||
|
||||
Reference in New Issue
Block a user