Skip to content

Node.js based forum software built for the modern web

closes #964

Baris Soner Usakli9b147edb369c
diff --git a/src/threadTools.js b/src/threadTools.js
index 5125eaf6a4..fa34bef729 100644
--- a/src/threadTools.js
+++ b/src/threadTools.js
@@ -189,14 +189,15 @@ var winston = require('winston'),
var topic;
async.waterfall([
function(next) {
- topics.getTopicFields(tid, ['cid', 'lastposttime', 'deleted'], next);
+ topics.getTopicFields(tid, ['cid', 'lastposttime', 'pinned', 'deleted'], next);
},
function(topicData, next) {
topic = topicData;
db.sortedSetRemove('categories:' + topicData.cid + ':tid', tid, next);
},
function(result, next) {
- db.sortedSetAdd('categories:' + cid + ':tid', topic.lastposttime, tid, next);
+ var timestamp = parseInt(topic.pinned, 10) ? Math.pow(2, 53) : topic.lastposttime;
+ db.sortedSetAdd('categories:' + cid + ':tid', timestamp, tid, next);
}
], function(err, result) {
if(err) {