Skip to content

Node.js based forum software built for the modern web

use currentTime when someone up/down votes

barisusaklie93398b647d4
diff --git a/src/favourites.js b/src/favourites.js
index 341766bdb3..123e014bc9 100644
--- a/src/favourites.js
+++ b/src/favourites.js
@@ -25,8 +25,10 @@ var async = require('async'),
return callback(new Error('[[error:cant-vote-self-post]]'));
}
+ var now = Date.now();
+
if(type === 'upvote' && !unvote) {
- db.sortedSetAdd('uid:' + uid + ':upvote', postData.timestamp, pid);
+ db.sortedSetAdd('uid:' + uid + ':upvote', now, pid);
} else {
db.sortedSetRemove('uid:' + uid + ':upvote', pid);
}
@@ -34,7 +36,7 @@ var async = require('async'),
if(type === 'upvote' || unvote) {
db.sortedSetRemove('uid:' + uid + ':downvote', pid);
} else {
- db.sortedSetAdd('uid:' + uid + ':downvote', postData.timestamp, pid);
+ db.sortedSetAdd('uid:' + uid + ':downvote', now, pid);
}
user[type === 'upvote' ? 'incrementUserFieldBy' : 'decrementUserFieldBy'](postData.uid, 'reputation', 1, function (err, newreputation) {