mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
closes #2624
This commit is contained in:
@@ -11,12 +11,18 @@ module.exports = function(Categories) {
|
|||||||
Categories.update = function(modified, callback) {
|
Categories.update = function(modified, callback) {
|
||||||
|
|
||||||
function updateCategory(cid, next) {
|
function updateCategory(cid, next) {
|
||||||
|
Categories.exists(cid, function(err, exists) {
|
||||||
|
if (err || !exists) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
var category = modified[cid];
|
var category = modified[cid];
|
||||||
var fields = Object.keys(category);
|
var fields = Object.keys(category);
|
||||||
|
|
||||||
async.each(fields, function(key, next) {
|
async.each(fields, function(key, next) {
|
||||||
updateCategoryField(cid, key, category[key], next);
|
updateCategoryField(cid, key, category[key], next);
|
||||||
}, next);
|
}, next);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var cids = Object.keys(modified);
|
var cids = Object.keys(modified);
|
||||||
|
|||||||
Reference in New Issue
Block a user