on post flag increment zset

This commit is contained in:
Barış Soner Uşaklı
2017-04-05 14:59:50 -04:00
parent ef2b245a82
commit 1b6d96dde7

View File

@@ -337,6 +337,9 @@ Flags.create = function (type, id, uid, reason, timestamp, callback) {
}
if (type === 'post') {
tasks.push(async.apply(db.sortedSetAdd.bind(db), 'flags:byPid:' + id, timestamp, flagId)); // by target pid
if (targetUid) {
tasks.push(async.apply(db.sortedSetIncrBy, 'users:flags', 1, targetUid));
}
}
async.parallel(tasks, function (err) {