load category parents and childrens in one call

add more missing guest/spider checks
This commit is contained in:
Barış Soner Uşaklı
2018-11-22 10:53:44 -05:00
parent a6864a8055
commit eba1a405d2
4 changed files with 55 additions and 27 deletions

View File

@@ -7,10 +7,16 @@ var categories = require('../categories');
module.exports = function (User) {
User.getIgnoredCategories = function (uid, callback) {
if (parseInt(uid, 10) <= 0) {
return setImmediate(callback, null, []);
}
db.getSortedSetRange('uid:' + uid + ':ignored:cids', 0, -1, callback);
};
User.getWatchedCategories = function (uid, callback) {
if (parseInt(uid, 10) <= 0) {
return setImmediate(callback, null, []);
}
async.waterfall([
function (next) {
async.parallel({