mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
only parse if field is requested
This commit is contained in:
@@ -27,7 +27,7 @@ module.exports = function (Categories) {
|
||||
}
|
||||
},
|
||||
function (categories, next) {
|
||||
categories.forEach(modifyCategory);
|
||||
categories.forEach(category => modifyCategory(category, fields));
|
||||
next(null, categories);
|
||||
},
|
||||
], callback);
|
||||
@@ -73,12 +73,12 @@ module.exports = function (Categories) {
|
||||
};
|
||||
};
|
||||
|
||||
function modifyCategory(category) {
|
||||
function modifyCategory(category, fields) {
|
||||
if (!category) {
|
||||
return;
|
||||
}
|
||||
|
||||
intFields.forEach(field => db.parseIntField(category, field));
|
||||
db.parseIntFields(category, intFields, fields);
|
||||
|
||||
if (category.hasOwnProperty('name')) {
|
||||
category.name = validator.escape(String(category.name || ''));
|
||||
|
||||
Reference in New Issue
Block a user