From b57109f6fd78242987b66e1ded6b06abe411c0e8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 7 May 2013 15:43:51 -0400 Subject: [PATCH] floating pinned articles to the top of the topic list --- src/topics.js | 6 ++++++ 1 file changed, 6 insertions(+) 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',