Skip to content

Node.js based forum software built for the modern web

floating pinned articles to the top of the topic list

Julian Lamb57109f6fd78
diff --git a/src/topics.js b/src/topics.js
index 94b36a872c..9697b87b7c 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -85,10 +85,16 @@ var RDB = require('./redis.js'),
'post_count' : postcount[i],
'lock-icon': locked[i] === '1' ? 'icon-lock' : 'hide',
'deleted': deleted[i],
+ 'pinned': parseInt(pinned[i] || 0), // For sorting purposes
'pin-icon': pinned[i] === '1' ? 'icon-pushpin' : 'hide'
});
}
+ // Float pinned topics to the top
+ topics = topics.sort(function(a, b) {
+ return b.pinned - a.pinned;
+ });
+
callback({
'category_name' : category_id ? category_name : 'Recent',
'show_topic_button' : category_id ? 'show' : 'hidden',