v1.18.x
Baris Soner Usakli 11 years ago
parent 64687fef6a
commit 2630a72f81

@ -38,8 +38,17 @@ var async = require('async'),
return false; return false;
} }
db[type === 'upvote' || !unvote ? 'sortedSetAdd' : 'sortedSetRemove']('uid:' + uid + ':upvote', postData.timestamp, pid); if(type === 'upvote' || !unvote) {
db[type === 'upvote' || unvote ? 'sortedSetRemove' : 'sortedSetAdd']('uid:' + uid + ':downvote', postData.timestamp, pid); db.sortedSetAdd('uid: ' + uid + ':upvote', postData.timestamp, pid);
} else {
db.sortedSetRemove('uid: ' + uid + ':upvote', pid);
}
if(type === 'upvote' || unvote) {
db.sortedSetRemove('uid: ' + uid + ':downvote', pid);
} else {
db.sortedSetAdd('uid: ' + uid + ':downvote', postData.timestamp, pid);
}
user[type === 'upvote' ? 'incrementUserFieldBy' : 'decrementUserFieldBy'](postData.uid, 'reputation', 1, function (err, newreputation) { user[type === 'upvote' ? 'incrementUserFieldBy' : 'decrementUserFieldBy'](postData.uid, 'reputation', 1, function (err, newreputation) {
db.sortedSetAdd('users:reputation', newreputation, postData.uid); db.sortedSetAdd('users:reputation', newreputation, postData.uid);

Loading…
Cancel
Save