fix tests, circular deps

v1.18.x
barisusakli 9 years ago
parent df7cfe2146
commit 6d946425fa

@ -7,7 +7,7 @@ var db = require('./database');
var user = require('./user');
var Groups = require('./groups');
var plugins = require('./plugins');
var privileges = require('./privileges');
(function(Categories) {
@ -102,6 +102,7 @@ var privileges = require('./privileges');
};
Categories.getCategoriesByPrivilege = function(set, uid, privilege, callback) {
var privileges = require('./privileges');
async.waterfall([
function(next) {
db.getSortedSetRange(set, 0, -1, next);
@ -238,6 +239,7 @@ var privileges = require('./privileges');
};
function getChildrenRecursive(category, uid, callback) {
var privileges = require('./privileges');
async.waterfall([
function (next) {
db.getSortedSetRange('cid:' + category.cid + ':children', 0, -1, next);

@ -3,7 +3,7 @@
var async = require('async');
var db = require('../database');
var privileges = require('../privileges');
var groups = require('../groups');
var plugins = require('../plugins');
var utils = require('../../public/src/utils');
@ -50,7 +50,7 @@ module.exports = function(Categories) {
category = data.category;
var defaultPrivileges = ['find', 'read', 'topics:read', 'topics:create', 'topics:reply', 'posts:edit', 'posts:delete', 'topics:delete', 'upload:post:image'];
var privileges = require('../privileges');
async.series([
async.apply(db.setObject, 'category:' + category.cid, category),
function (next) {
@ -139,6 +139,7 @@ module.exports = function(Categories) {
};
Categories.copyPrivilegesFrom = function(fromCid, toCid, callback) {
var privileges = require('../privileges');
async.each(privileges.privilegeList, function(privilege, next) {
copyPrivilege(privilege, fromCid, toCid, next);
}, callback);

@ -5,7 +5,6 @@ var async = require('async');
var _ = require('underscore');
var user = require('../user');
var categories = require('../categories');
var groups = require('../groups');
var helpers = require('./helpers');
var plugins = require('../plugins');
@ -220,6 +219,7 @@ module.exports = function(privileges) {
if (!cid) {
return callback(null, false);
}
var categories = require('../categories');
categories.getCategoryField(cid, 'disabled', function(err, disabled) {
if (err) {
return callback(err);
@ -269,6 +269,7 @@ module.exports = function(privileges) {
};
privileges.categories.getBase = function(privilege, cids, uid, callback) {
var categories = require('../categories');
async.parallel({
categories: function(next) {
categories.getCategoriesFields(cids, ['disabled'], next);

Loading…
Cancel
Save