Node.js based forum software built for the modern web
closes #3614
Barış Soner Uşaklı5b0853826484
diff --git a/public/src/admin/manage/category.js b/public/src/admin/manage/category.jsindex 25832bcac6..c16809e44f 100644--- a/public/src/admin/manage/category.js+++ b/public/src/admin/manage/category.js@@ -234,6 +234,14 @@ define('admin/manage/category', [Category.launchParentSelector = function() {socket.emit('categories.get', function(err, categories) {+ if (err) {+ return app.alertError(err.message);+ }++ categories = categories.filter(function(category) {+ return category && parseInt(category.cid, 10) !== parseInt(ajaxify.data.category.cid, 10);+ });+templates.parse('partials/category_list', {categories: categories}, function(html) {diff --git a/src/categories.js b/src/categories.jsindex 0626de3349..a7cd08eebe 100644--- a/src/categories.js+++ b/src/categories.js@@ -333,6 +333,9 @@ var async = require('async'),privileges.categories.filterCids('find', children, uid, next);},function (children, next) {+ children = children.filter(function(cid) {+ return parseInt(category.cid, 10) !== parseInt(cid, 10);+ });if (!children.length) {category.children = [];return callback();diff --git a/src/categories/update.js b/src/categories/update.jsindex 036b405c96..9ad8acf61e 100644--- a/src/categories/update.js+++ b/src/categories/update.js@@ -68,6 +68,9 @@ module.exports = function(Categories) {}function updateParent(cid, newParent, callback) {+ if (parseInt(cid, 10) === parseInt(newParent, 10)) {+ return callback(new Error('[[error:cant-set-self-as-parent]]'));+ }Categories.getCategoryField(cid, 'parentCid', function(err, oldParent) {if (err) {return callback(err);