diff --git a/.gitignore b/.gitignore index 2f966c4535..82ed213c66 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ public/css/*.css *.sublime-project *.sublime-workspace .project -.idea *.swp Vagrantfile .vagrant @@ -31,4 +30,14 @@ pidfile /public/stylesheet.css /public/admin.css /public/nodebb.min.js -/public/nodebb.min.js.map \ No newline at end of file +/public/nodebb.min.js.map + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio +*.iml + +## Directory-based project format: +.idea/ + +## File-based project format: +*.ipr +*.iws \ No newline at end of file diff --git a/src/categories/update.js b/src/categories/update.js index f1d9ee773c..6ea03b8930 100644 --- a/src/categories/update.js +++ b/src/categories/update.js @@ -16,7 +16,14 @@ module.exports = function(Categories) { return next(err); } - plugins.fireHook('filter:category.update', modified[cid], function(err, category) { + var modifiedFields = modified[cid]; + + if(modifiedFields.hasOwnProperty('name')){ + modifiedFields.slug = cid + '/' + utils.slugify(modifiedFields.name); + } + + plugins.fireHook('filter:category.update', {category:modifiedFields}, function(err, categoryData) { + var category = categoryData.category; var fields = Object.keys(category); async.each(fields, function(key, next) { updateCategoryField(cid, key, category[key], next); @@ -44,10 +51,7 @@ module.exports = function(Categories) { return callback(err); } - if (key === 'name') { - var slug = cid + '/' + utils.slugify(value); - db.setObjectField('category:' + cid, 'slug', slug, callback); - } else if (key === 'order') { + if (key === 'order') { db.sortedSetAdd('categories:cid', value, cid, callback); } else { callback();