v1.18.x
Barış Soner Uşaklı 10 years ago
parent 4acb31839e
commit 5b08538264

@ -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) {

@ -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();

@ -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);

Loading…
Cancel
Save