Skip to content

Node.js based forum software built for the modern web

fix: sortable topics even if only 1 pinned topic

Julian Lam6765de3db3f5
diff --git a/public/src/client/category/tools.js b/public/src/client/category/tools.js
index 3e973c68a3..f219a399af 100644
--- a/public/src/client/category/tools.js
+++ b/public/src/client/category/tools.js
@@ -254,9 +254,15 @@ define('forum/category/tools', [
}
function handlePinnedTopicSort() {
- if (!ajaxify.data.privileges.isAdminOrMod) {
+ var numPinned = ajaxify.data.topics.reduce(function (memo, topic) {
+ memo = topic.pinned ? memo += 1 : memo;
+ return memo;
+ }, 0);
+
+ if (!ajaxify.data.privileges.isAdminOrMod || numPinned < 2) {
return;
}
+
app.loadJQueryUI(function () {
var topicListEl = $('[component="category"]').filter(function (i, e) {
return !$(e).parents('[widget-area],[data-widget-area]').length;