mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-06 15:42:52 +01:00
closes #4754
This commit is contained in:
@@ -90,7 +90,7 @@ module.exports = function(Topics) {
|
||||
if (!exists) {
|
||||
return next(new Error('[[error:no-topic]]'));
|
||||
}
|
||||
posts.getPostFields(pid, ['tid', 'uid', 'timestamp', 'votes'], next);
|
||||
posts.getPostFields(pid, ['tid', 'uid', 'timestamp', 'upvotes', 'downvotes'], next);
|
||||
},
|
||||
function(post, next) {
|
||||
if (!post || !post.tid) {
|
||||
|
||||
@@ -278,7 +278,10 @@ module.exports = function(Topics) {
|
||||
db.sortedSetAdd('tid:' + tid + ':posts', postData.timestamp, postData.pid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetAdd('tid:' + tid + ':posts:votes', postData.votes, postData.pid, next);
|
||||
var upvotes = parseInt(postData.upvotes, 10) || 0;
|
||||
var downvotes = parseInt(postData.downvotes, 10) || 0;
|
||||
var votes = upvotes - downvotes;
|
||||
db.sortedSetAdd('tid:' + tid + ':posts:votes', votes, postData.pid, next);
|
||||
}
|
||||
], function(err) {
|
||||
next(err);
|
||||
|
||||
Reference in New Issue
Block a user