mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
closes #4355
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
"nodebb-plugin-spam-be-gone": "0.4.5",
|
||||
"nodebb-rewards-essentials": "0.0.8",
|
||||
"nodebb-theme-lavender": "3.0.9",
|
||||
"nodebb-theme-persona": "4.0.93",
|
||||
"nodebb-theme-persona": "4.0.94",
|
||||
"nodebb-theme-vanilla": "5.0.54",
|
||||
"nodebb-widget-essentials": "2.0.8",
|
||||
"nodemailer": "2.0.0",
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
'<i style="color:' + child.color + ';" class="fa fa-stack-1x ' + child.icon + '"></i>' +
|
||||
'</span><small>' + child.name + '</small></a> ';
|
||||
});
|
||||
html = html ? ('<br/><span class="category-children">' + html + '</span>') : html;
|
||||
html = html ? ('<span class="category-children">' + html + '</span>') : html;
|
||||
return html;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ module.exports = function(Categories) {
|
||||
db.incrObjectField('global', 'nextCid', next);
|
||||
},
|
||||
function(cid, next) {
|
||||
var slug = cid + '/' + utils.slugify(data.name),
|
||||
order = data.order || cid, // If no order provided, place it at the end
|
||||
colours = Categories.assignColours();
|
||||
var slug = cid + '/' + utils.slugify(data.name);
|
||||
var order = data.order || cid; // If no order provided, place it at the end
|
||||
var colours = Categories.assignColours();
|
||||
|
||||
category = {
|
||||
cid: cid,
|
||||
name: data.name,
|
||||
description: ( data.description ? data.description : '' ),
|
||||
icon: ( data.icon ? data.icon : '' ),
|
||||
description: data.description ? data.description : '',
|
||||
icon: data.icon ? data.icon : '',
|
||||
bgColor: data.bgColor || colours[0],
|
||||
color: data.color || colours[1],
|
||||
slug: slug,
|
||||
@@ -49,6 +49,7 @@ module.exports = function(Categories) {
|
||||
|
||||
async.series([
|
||||
async.apply(db.setObject, 'category:' + category.cid, category),
|
||||
async.apply(Categories.parseDescription, category.cid, category.description),
|
||||
async.apply(db.sortedSetAdd, 'categories:cid', category.order, category.cid),
|
||||
async.apply(db.sortedSetAdd, 'cid:' + parentCid + ':children', category.order, category.cid),
|
||||
async.apply(privileges.categories.give, defaultPrivileges, category.cid, 'administrators'),
|
||||
|
||||
@@ -72,7 +72,7 @@ module.exports = function(Categories) {
|
||||
if (key === 'order') {
|
||||
updateOrder(cid, value, callback);
|
||||
} else if (key === 'description') {
|
||||
parseDescription(cid, value, callback);
|
||||
Categories.parseDescription(cid, value, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
@@ -100,7 +100,7 @@ module.exports = function(Categories) {
|
||||
function (next) {
|
||||
db.setObjectField('category:' + cid, 'parentCid', newParent, next);
|
||||
}
|
||||
], function(err, results) {
|
||||
], function(err) {
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
@@ -124,13 +124,13 @@ module.exports = function(Categories) {
|
||||
});
|
||||
}
|
||||
|
||||
function parseDescription(cid, description, callback) {
|
||||
Categories.parseDescription = function(cid, description, callback) {
|
||||
plugins.fireHook('filter:parse.raw', description, function(err, parsedDescription) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
Categories.setCategoryField(cid, 'descriptionParsed', parsedDescription, callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user