Node.js based forum software built for the modern web
closes #6214
Barış Soner Uşaklıb58387c82287
diff --git a/src/topics/tools.js b/src/topics/tools.jsindex be87b8826f..a7c22b5989 100644--- a/src/topics/tools.js+++ b/src/topics/tools.js@@ -258,7 +258,7 @@ module.exports = function (Topics) {if (!exists) {return next(new Error('[[error:no-topic]]'));}- Topics.getTopicFields(tid, ['cid', 'lastposttime', 'pinned', 'deleted', 'postcount'], next);+ Topics.getTopicFields(tid, ['cid', 'lastposttime', 'pinned', 'deleted', 'postcount', 'upvotes', 'downvotes'], next);},function (topicData, next) {topic = topicData;@@ -266,6 +266,7 @@ module.exports = function (Topics) {'cid:' + topicData.cid + ':tids','cid:' + topicData.cid + ':tids:pinned','cid:' + topicData.cid + ':tids:posts',+ 'cid:' + topicData.cid + ':tids:votes','cid:' + topicData.cid + ':tids:lastposttime','cid:' + topicData.cid + ':recent_tids',], tid, next);@@ -273,6 +274,10 @@ module.exports = function (Topics) {function (next) {db.sortedSetAdd('cid:' + cid + ':tids:lastposttime', topic.lastposttime, tid, next);},+ function (next) {+ var votes = (parseInt(topic.upvotes, 10) || 0) - (parseInt(topic.downvotes, 10) || 0);+ db.sortedSetAdd('cid:' + cid + ':tids:votes', votes, tid, next);+ },function (next) {if (parseInt(topic.pinned, 10)) {db.sortedSetAdd('cid:' + cid + ':tids:pinned', Date.now(), tid, next);