|
|
|
@ -161,7 +161,10 @@ var RDB = require('./redis.js'),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isTopicVisible(topicData, topicInfo) {
|
|
|
|
|
var deleted = parseInt(topicData.deleted, 10) !== 0;
|
|
|
|
|
return !deleted || (deleted && topicInfo.privileges.view_deleted) || topicData.uid === current_user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(var i=0; i<tids.length; ++i) {
|
|
|
|
|
|
|
|
|
@ -181,7 +184,7 @@ var RDB = require('./redis.js'),
|
|
|
|
|
topicData.teaser_username = topicInfo.teaserInfo.username;
|
|
|
|
|
topicData.teaser_timestamp = utils.relativeTime(topicInfo.teaserInfo.timestamp);
|
|
|
|
|
|
|
|
|
|
if (!topicData.deleted || (topicData.deleted && topicInfo.privileges.view_deleted) || topicData.uid === current_user)
|
|
|
|
|
if (isTopicVisible(topicData, topicInfo))
|
|
|
|
|
retrieved_topics.push(topicData);
|
|
|
|
|
else
|
|
|
|
|
--topicCountToLoad;
|
|
|
|
@ -302,6 +305,14 @@ var RDB = require('./redis.js'),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Categories.setCategoryField = function(cid, field, value) {
|
|
|
|
|
RDB.hset('category:' + cid, field, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Categories.incrementCategoryFieldBy = function(cid, field, value) {
|
|
|
|
|
RDB.hincrby('category:' + cid, field, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Categories.getCategories = function(cids, callback, current_user) {
|
|
|
|
|
if (cids.length === 0) {
|
|
|
|
|
callback({'categories' : []});
|
|
|
|
|