From 73e21d1d3172a89c4645a43181efea61c20d32a3 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 8 Jun 2016 10:46:33 +0300 Subject: [PATCH] closes #4720 --- src/categories/delete.js | 19 +++++++++++++------ src/groups/delete.js | 8 ++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/categories/delete.js b/src/categories/delete.js index c8a383037e..63f9fe324b 100644 --- a/src/categories/delete.js +++ b/src/categories/delete.js @@ -1,10 +1,12 @@ 'use strict'; -var async = require('async'), - db = require('../database'), - batch = require('../batch'), - plugins = require('../plugins'), - topics = require('../topics'); +var async = require('async'); +var db = require('../database'); +var batch = require('../batch'); +var plugins = require('../plugins'); +var topics = require('../topics'); +var privileges = require('../privileges'); +var groups = require('../groups'); module.exports = function(Categories) { @@ -42,6 +44,11 @@ module.exports = function(Categories) { 'cid:' + cid + ':children', 'category:' + cid ], next); + }, + function(next) { + async.each(privileges.privilegeList, function(privilege, next) { + groups.destroy('cid:' + cid + ':privileges:' + privilege, next); + }, next); } ], callback); } @@ -78,7 +85,7 @@ module.exports = function(Categories) { } ], next); } - ], function(err, results) { + ], function(err) { callback(err); }); } diff --git a/src/groups/delete.js b/src/groups/delete.js index 8e665249a8..ca062b364a 100644 --- a/src/groups/delete.js +++ b/src/groups/delete.js @@ -1,9 +1,9 @@ 'use strict'; -var async = require('async'), - plugins = require('../plugins'), - utils = require('../../public/src/utils'), - db = require('./../database'); +var async = require('async'); +var plugins = require('../plugins'); +var utils = require('../../public/src/utils'); +var db = require('./../database'); module.exports = function(Groups) {