v1.18.x
barisusakli 10 years ago
parent 035c32df66
commit feed33f6e2

@ -435,10 +435,10 @@ var db = require('./database'),
db.incrObjectField('category:' + cid, 'post_count', next); db.incrObjectField('category:' + cid, 'post_count', next);
}, },
function(next) { function(next) {
if(parseInt(topicData.pinned, 10) === 0) { if (parseInt(topicData.pinned, 10) === 1) {
db.sortedSetAdd('categories:' + cid + ':tid', postData.timestamp, postData.tid, next);
} else {
next(); next();
} else {
db.sortedSetAdd('categories:' + cid + ':tid', postData.timestamp, postData.tid, next);
} }
} }
], callback); ], callback);

@ -87,7 +87,7 @@ module.exports = function(db, module) {
item = item || {}; item = item || {};
var result = {}; var result = {};
for(i=0; i<fields.length; ++i) { for(i=0; i<fields.length; ++i) {
result[fields[i]] = item[fields[i]] || null; result[fields[i]] = item[fields[i]] !== undefined ? item[fields[i]] : null;
} }
callback(null, result); callback(null, result);
}); });

Loading…
Cancel
Save