Skip to content

Node.js based forum software built for the modern web

#433

Baris Soner Usakliab1015b11e37
diff --git a/src/categories.js b/src/categories.js
index 6a67d34775..9833720896 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -87,11 +87,6 @@ var RDB = require('./redis.js'),
function getTopics(next) {
topics.getTopicsByTids(tids, current_user, function(topicsData) {
- // Float pinned topics to the top of the list
- topicsData = topicsData.sort(function(a, b) {
- return parseInt(b.pinned, 10) - parseInt(a.pinned, 10);
- });
-
next(null, topicsData);
}, category_id);
}
diff --git a/src/posts.js b/src/posts.js
index 68172644f1..ae6c5f53e5 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -365,13 +365,18 @@ var RDB = require('./redis.js'),
RDB.incr('totalpostcount');
- topics.getTopicField(tid, 'cid', function(err, cid) {
+ topics.getTopicFields(tid, ['cid', 'pinned'], function(err, topicData) {
+
RDB.handle(err);
+ var cid = topicData.cid;
+
feed.updateTopic(tid);
RDB.zadd('categories:recent_posts:cid:' + cid, timestamp, pid);
- RDB.zadd('categories:' + cid + ':tid', timestamp, tid);
+
+ if(topicData.pinned === '0')
+ RDB.zadd('categories:' + cid + ':tid', timestamp, tid);
RDB.scard('cid:' + cid + ':active_users', function(err, amount) {
if (amount > 10) {