From 2f57a4b9a62d3d27424a11b36a4f709f49e03127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 12 Dec 2018 14:35:51 -0500 Subject: [PATCH] fix: dont update cid::tids:votes if topic is pinned --- src/posts/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/posts/index.js b/src/posts/index.js index 7790593d3f..2c514ed108 100644 --- a/src/posts/index.js +++ b/src/posts/index.js @@ -157,7 +157,7 @@ Posts.updatePostVoteCount = function (postData, callback) { function (next) { async.waterfall([ function (next) { - topics.getTopicFields(postData.tid, ['mainPid', 'cid'], next); + topics.getTopicFields(postData.tid, ['mainPid', 'cid', 'pinned'], next); }, function (topicData, next) { if (parseInt(topicData.mainPid, 10) === parseInt(postData.pid, 10)) { @@ -172,7 +172,11 @@ Posts.updatePostVoteCount = function (postData, callback) { db.sortedSetAdd('topics:votes', postData.votes, postData.tid, next); }, function (next) { - db.sortedSetAdd('cid:' + topicData.cid + ':tids:votes', postData.votes, postData.tid, next); + if (!topicData.pinned) { + db.sortedSetAdd('cid:' + topicData.cid + ':tids:votes', postData.votes, postData.tid, next); + } else { + next(); + } }, ], function (err) { next(err);