mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
feat: #7023
- add category selector to privileges and category create modals - allow category selector to work for multiple selectors on same page
This commit is contained in:
@@ -21,7 +21,7 @@ SocketCategories.get = function (socket, data, callback) {
|
||||
isAdmin: async.apply(user.isAdministrator, socket.uid),
|
||||
categories: function (next) {
|
||||
async.waterfall([
|
||||
async.apply(categories.getAllCidsFromSet, 'categories:cid'),
|
||||
async.apply(categories.getCidsByPrivilege, 'categories:cid', socket.uid, 'find'),
|
||||
async.apply(categories.getCategoriesData),
|
||||
], next);
|
||||
},
|
||||
@@ -132,23 +132,16 @@ SocketCategories.getCategoriesByPrivilege = function (socket, privilege, callbac
|
||||
};
|
||||
|
||||
SocketCategories.getMoveCategories = function (socket, data, callback) {
|
||||
SocketCategories.getSelectCategories(socket, data, callback);
|
||||
};
|
||||
|
||||
SocketCategories.getSelectCategories = function (socket, data, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
async.parallel({
|
||||
isAdmin: async.apply(user.isAdministrator, socket.uid),
|
||||
categories: function (next) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
categories.getAllCidsFromSet('categories:cid', next);
|
||||
},
|
||||
function (cids, next) {
|
||||
categories.getCategories(cids, socket.uid, next);
|
||||
},
|
||||
function (categoriesData, next) {
|
||||
categoriesData = categories.getTree(categoriesData);
|
||||
categories.buildForSelectCategories(categoriesData, next);
|
||||
},
|
||||
], next);
|
||||
categories.buildForSelect(socket.uid, 'find', next);
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user