derp, upgrade was upvoting your own favourited posts as well

This commit is contained in:
psychobunny
2014-02-06 16:55:41 -05:00
parent d9f61385ca
commit a9fbd5be8a

View File

@@ -491,9 +491,11 @@ Upgrade.upgrade = function(callback) {
var pid = post.pid,
uid = user.uid;
db.setAdd('pid:' + pid + ':upvote', uid);
db.sortedSetAdd('uid:' + uid + ':upvote', post.timestamp, pid);
db.incrObjectField('post:' + pid, 'votes');
if (post.uid !== uid) {
db.setAdd('pid:' + pid + ':upvote', uid);
db.sortedSetAdd('uid:' + uid + ':upvote', post.timestamp, pid);
db.incrObjectField('post:' + pid, 'votes');
}
next();
}