mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
fix: dont update cid:<cid>:tids:votes if topic is pinned
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user