mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
Add parameters for create categories
This commit is contained in:
@@ -19,19 +19,19 @@ module.exports = function(Categories) {
|
|||||||
var category = {
|
var category = {
|
||||||
cid: cid,
|
cid: cid,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
description: data.description,
|
description: ( data.description ? data.description : '' ),
|
||||||
icon: data.icon,
|
icon: ( data.icon ? data.icon : '' ),
|
||||||
bgColor: data.bgColor,
|
bgColor: ( data.bgColor ? data.bgColor : '' ),
|
||||||
color: data.color,
|
color: ( data.color ? data.color : '' ),
|
||||||
slug: slug,
|
slug: slug,
|
||||||
parentCid: 0,
|
parentCid: ( data.parentCid ? data.parentCid : 0 ),
|
||||||
topic_count: 0,
|
topic_count: 0,
|
||||||
post_count: 0,
|
post_count: 0,
|
||||||
disabled: 0,
|
disabled: 0,
|
||||||
order: order,
|
order: ( data.order ? data.order : cid ),
|
||||||
link: '',
|
link: '',
|
||||||
numRecentReplies: 1,
|
numRecentReplies: 1,
|
||||||
class: 'col-md-3 col-xs-6',
|
class: ( data.class ? data.class : 'col-md-3 col-xs-6' ),
|
||||||
imageClass: 'auto'
|
imageClass: 'auto'
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ module.exports = function(Categories) {
|
|||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
async.apply(db.setObject, 'category:' + cid, category),
|
async.apply(db.setObject, 'category:' + cid, category),
|
||||||
async.apply(db.sortedSetAdd, 'categories:cid', order, cid),
|
async.apply(db.sortedSetAdd, 'categories:cid', data.order, cid),
|
||||||
async.apply(privileges.categories.give, defaultPrivileges, cid, 'administrators'),
|
async.apply(privileges.categories.give, defaultPrivileges, cid, 'administrators'),
|
||||||
async.apply(privileges.categories.give, defaultPrivileges, cid, 'registered-users'),
|
async.apply(privileges.categories.give, defaultPrivileges, cid, 'registered-users'),
|
||||||
async.apply(privileges.categories.give, ['find', 'read'], cid, 'guests')
|
async.apply(privileges.categories.give, ['find', 'read'], cid, 'guests')
|
||||||
|
|||||||
Reference in New Issue
Block a user