|
|
@ -28,6 +28,7 @@ module.exports = function(Categories) {
|
|
|
|
cid: cid,
|
|
|
|
cid: cid,
|
|
|
|
name: data.name,
|
|
|
|
name: data.name,
|
|
|
|
description: data.description ? data.description : '',
|
|
|
|
description: data.description ? data.description : '',
|
|
|
|
|
|
|
|
descriptionParsed: data.descriptionParsed ? data.descriptionParsed : '',
|
|
|
|
icon: data.icon ? data.icon : '',
|
|
|
|
icon: data.icon ? data.icon : '',
|
|
|
|
bgColor: data.bgColor || colours[0],
|
|
|
|
bgColor: data.bgColor || colours[0],
|
|
|
|
color: data.color || colours[1],
|
|
|
|
color: data.color || colours[1],
|
|
|
@ -52,7 +53,12 @@ module.exports = function(Categories) {
|
|
|
|
|
|
|
|
|
|
|
|
async.series([
|
|
|
|
async.series([
|
|
|
|
async.apply(db.setObject, 'category:' + category.cid, category),
|
|
|
|
async.apply(db.setObject, 'category:' + category.cid, category),
|
|
|
|
async.apply(Categories.parseDescription, category.cid, category.description),
|
|
|
|
function (next) {
|
|
|
|
|
|
|
|
if (category.descriptionParsed) {
|
|
|
|
|
|
|
|
return next();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Categories.parseDescription(category.cid, category.description, next);
|
|
|
|
|
|
|
|
},
|
|
|
|
async.apply(db.sortedSetAdd, 'categories:cid', category.order, category.cid),
|
|
|
|
async.apply(db.sortedSetAdd, 'categories:cid', category.order, category.cid),
|
|
|
|
async.apply(db.sortedSetAdd, 'cid:' + parentCid + ':children', category.order, category.cid),
|
|
|
|
async.apply(db.sortedSetAdd, 'cid:' + parentCid + ':children', category.order, category.cid),
|
|
|
|
async.apply(privileges.categories.give, defaultPrivileges, category.cid, 'administrators'),
|
|
|
|
async.apply(privileges.categories.give, defaultPrivileges, category.cid, 'administrators'),
|
|
|
|