Node.js based forum software built for the modern web
fix: custom navigation item not showing groups
Barış Soner Uşaklıd9452bf3d452
diff --git a/public/src/admin/general/navigation.js b/public/src/admin/general/navigation.jsindex 8a9e1718e6..c34457c5db 100644--- a/public/src/admin/general/navigation.js+++ b/public/src/admin/general/navigation.js@@ -63,7 +63,7 @@ define('admin/general/navigation', ['translator', 'iconSelect', 'benchpress', 'jfunction drop(ev, ui) {var id = ui.helper.attr('data-id');var el = $('#active-navigation [data-id="' + id + '"]');- var data = id === 'custom' ? { iconClass: 'fa-navicon' } : available[id];+ var data = id === 'custom' ? { iconClass: 'fa-navicon', groups: available[0].groups } : available[id];data.enabled = false;data.index = (parseInt($('#enabled').children().last().attr('data-index'), 10) || 0) + 1;diff --git a/src/controllers/admin/navigation.js b/src/controllers/admin/navigation.jsindex cc3aa3ce24..6f20282404 100644--- a/src/controllers/admin/navigation.js+++ b/src/controllers/admin/navigation.js@@ -17,17 +17,23 @@ navigationController.get = function (req, res, next) {}, next);},function (result) {+ result.groups.sort((a, b) => b.system - a.system);+ result.groups = result.groups.map(group => ({ name: group.name, displayName: group.displayName }));+result.admin.enabled.forEach(function (enabled, index) {enabled.index = index;enabled.selected = index === 0;- const groupData = _.cloneDeep(result.groups);- enabled.groups = groupData.map(function (group) {- group.selected = enabled.groups.includes(group.name);- return group;+ enabled.groups = result.groups.map(function (group) {+ return {+ displayName: group.displayName,+ selected: enabled.groups.includes(group.name),+ };});+ });- enabled.groups.sort((a, b) => b.system - a.system);+ result.admin.available.forEach(function (available) {+ available.groups = result.groups;});result.admin.navigation = result.admin.enabled.slice();