Fix space-before-function-paren linter rule

This commit is contained in:
HeeL
2016-10-13 11:43:39 +02:00
parent 3fa1c1f927
commit 4a3c31b2dc
385 changed files with 6621 additions and 6622 deletions

View File

@@ -10,25 +10,25 @@ var apiController = require('../controllers/api');
var SocketCategories = {};
SocketCategories.getRecentReplies = function(socket, cid, callback) {
SocketCategories.getRecentReplies = function (socket, cid, callback) {
categories.getRecentReplies(cid, socket.uid, 4, callback);
};
SocketCategories.get = function(socket, data, callback) {
SocketCategories.get = function (socket, data, callback) {
async.parallel({
isAdmin: async.apply(user.isAdministrator, socket.uid),
categories: function(next) {
categories: function (next) {
async.waterfall([
async.apply(db.getSortedSetRange, 'categories:cid', 0, -1),
async.apply(categories.getCategoriesData),
], next);
}
}, function(err, results) {
}, function (err, results) {
if (err) {
return callback(err);
}
results.categories = results.categories.filter(function(category) {
results.categories = results.categories.filter(function (category) {
return category && (!category.disabled || results.isAdmin);
});
@@ -36,41 +36,41 @@ SocketCategories.get = function(socket, data, callback) {
});
};
SocketCategories.getWatchedCategories = function(socket, data, callback) {
SocketCategories.getWatchedCategories = function (socket, data, callback) {
async.parallel({
categories: async.apply(categories.getCategoriesByPrivilege, socket.uid, 'find'),
ignoredCids: async.apply(user.getIgnoredCategories, socket.uid)
}, function(err, results) {
}, function (err, results) {
if (err) {
return callback(err);
}
var watchedCategories = results.categories.filter(function(category) {
var watchedCategories = results.categories.filter(function (category) {
return category && results.ignoredCids.indexOf(category.cid.toString()) === -1;
});
callback(null, watchedCategories);
});
};
SocketCategories.loadMore = function(socket, data, callback) {
SocketCategories.loadMore = function (socket, data, callback) {
if (!data) {
return callback(new Error('[[error:invalid-data]]'));
}
async.parallel({
privileges: function(next) {
privileges: function (next) {
privileges.categories.get(data.cid, socket.uid, next);
},
settings: function(next) {
settings: function (next) {
user.getSettings(socket.uid, next);
},
targetUid: function(next) {
targetUid: function (next) {
if (data.author) {
user.getUidByUserslug(data.author, next);
} else {
next();
}
}
}, function(err, results) {
}, function (err, results) {
if (err) {
return callback(err);
}
@@ -118,7 +118,7 @@ SocketCategories.loadMore = function(socket, data, callback) {
uid: socket.uid,
targetUid: results.targetUid,
settings: results.settings
}, function(err, data) {
}, function (err, data) {
if (err) {
return callback(err);
}
@@ -136,22 +136,22 @@ SocketCategories.loadMore = function(socket, data, callback) {
});
};
SocketCategories.getPageCount = function(socket, cid, callback) {
SocketCategories.getPageCount = function (socket, cid, callback) {
categories.getPageCount(cid, socket.uid, callback);
};
SocketCategories.getTopicCount = function(socket, cid, callback) {
SocketCategories.getTopicCount = function (socket, cid, callback) {
categories.getCategoryField(cid, 'topic_count', callback);
};
SocketCategories.getCategoriesByPrivilege = function(socket, privilege, callback) {
SocketCategories.getCategoriesByPrivilege = function (socket, privilege, callback) {
categories.getCategoriesByPrivilege('categories:cid', socket.uid, privilege, callback);
};
SocketCategories.getMoveCategories = function(socket, data, callback) {
SocketCategories.getMoveCategories = function (socket, data, callback) {
async.parallel({
isAdmin: async.apply(user.isAdministrator, socket.uid),
categories: function(next) {
categories: function (next) {
async.waterfall([
function (next) {
db.getSortedSetRange('cid:0:children', 0, -1, next);
@@ -161,12 +161,12 @@ SocketCategories.getMoveCategories = function(socket, data, callback) {
}
], next);
}
}, function(err, results) {
}, function (err, results) {
if (err) {
return callback(err);
}
results.categories = results.categories.filter(function(category) {
results.categories = results.categories.filter(function (category) {
return category && (!category.disabled || results.isAdmin) && !category.link;
});
@@ -174,24 +174,24 @@ SocketCategories.getMoveCategories = function(socket, data, callback) {
});
};
SocketCategories.watch = function(socket, cid, callback) {
SocketCategories.watch = function (socket, cid, callback) {
ignoreOrWatch(user.watchCategory, socket, cid, callback);
};
SocketCategories.ignore = function(socket, cid, callback) {
SocketCategories.ignore = function (socket, cid, callback) {
ignoreOrWatch(user.ignoreCategory, socket, cid, callback);
};
function ignoreOrWatch(fn, socket, cid, callback) {
async.waterfall([
function(next) {
function (next) {
db.getSortedSetRange('categories:cid', 0, -1, next);
},
function(cids, next) {
function (cids, next) {
categories.getCategoriesFields(cids, ['cid', 'parentCid'], next);
},
function(categoryData, next) {
categoryData.forEach(function(c) {
function (categoryData, next) {
categoryData.forEach(function (c) {
c.cid = parseInt(c.cid, 10);
c.parentCid = parseInt(c.parentCid, 10);
});
@@ -203,7 +203,7 @@ function ignoreOrWatch(fn, socket, cid, callback) {
var any = true;
while (any) {
any = false;
categoryData.forEach(function(c) {
categoryData.forEach(function (c) {
if (cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1) {
cids.push(c.cid);
any = true;
@@ -211,21 +211,21 @@ function ignoreOrWatch(fn, socket, cid, callback) {
});
}
async.each(cids, function(cid, next) {
async.each(cids, function (cid, next) {
fn(socket.uid, cid, next);
}, next);
},
function(next) {
function (next) {
topics.pushUnreadCount(socket.uid, next);
}
], callback);
}
SocketCategories.isModerator = function(socket, cid, callback) {
SocketCategories.isModerator = function (socket, cid, callback) {
user.isModerator(socket.uid, cid, callback);
};
SocketCategories.getCategory = function(socket, cid, callback) {
SocketCategories.getCategory = function (socket, cid, callback) {
apiController.getCategoryData(cid, socket.uid, callback);
};