fix: sortable topics even if only 1 pinned topic

v1.18.x
Julian Lam 5 years ago
parent dd2bc18927
commit 6765de3db3

@ -254,9 +254,15 @@ define('forum/category/tools', [
} }
function handlePinnedTopicSort() { 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; return;
} }
app.loadJQueryUI(function () { app.loadJQueryUI(function () {
var topicListEl = $('[component="category"]').filter(function (i, e) { var topicListEl = $('[component="category"]').filter(function (i, e) {
return !$(e).parents('[widget-area],[data-widget-area]').length; return !$(e).parents('[widget-area],[data-widget-area]').length;

Loading…
Cancel
Save