mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-05 21:17:05 +02:00
Add admin hooks for get categories
This commit is contained in:
@@ -135,11 +135,17 @@ adminController.categories.get = function(req, res, next) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.render('admin/manage/category', {
|
||||
category: data.category[0],
|
||||
privileges: data.privileges
|
||||
});
|
||||
|
||||
plugins.fireHook('filter:admin.categories.get', {req: req, res: res, category: data.category[0], privileges: data.privileges}, function(err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.render('admin/manage/category', {
|
||||
category: data.category,
|
||||
privileges: data.privileges
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -152,14 +158,20 @@ adminController.categories.getAll = function(req, res, next) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
plugins.fireHook('filter:admin.categories.getAll', {req: req, res: res, categories: categoryData}, function(err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
data.categories.filter(Boolean).forEach(function(category) {
|
||||
(category.disabled ? disabled : active).push(category);
|
||||
});
|
||||
|
||||
categoryData.filter(Boolean).forEach(function(category) {
|
||||
(category.disabled ? disabled : active).push(category);
|
||||
});
|
||||
|
||||
res.render('admin/manage/categories', {
|
||||
active: active,
|
||||
disabled: disabled
|
||||
res.render('admin/manage/categories', {
|
||||
active: active,
|
||||
disabled: disabled
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user