mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-26 08:36:36 +02:00
remove more parseInts
This commit is contained in:
@@ -9,7 +9,7 @@ var privileges = require('../../privileges');
|
||||
var privilegesController = module.exports;
|
||||
|
||||
privilegesController.get = function (req, res, callback) {
|
||||
var cid = req.params.cid ? req.params.cid : 0;
|
||||
var cid = req.params.cid ? parseInt(req.params.cid, 10) : 0;
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
async.parallel({
|
||||
@@ -38,7 +38,7 @@ privilegesController.get = function (req, res, callback) {
|
||||
function (data) {
|
||||
data.allCategories.forEach(function (category) {
|
||||
if (category) {
|
||||
category.selected = parseInt(category.cid, 10) === parseInt(cid, 10);
|
||||
category.selected = category.cid === cid;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -262,9 +262,7 @@ function getCategoryData(cids, uid, selectedCid, callback) {
|
||||
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'link', 'color', 'bgColor', 'parentCid', 'image', 'imageClass'], next);
|
||||
},
|
||||
function (categoryData, next) {
|
||||
categoryData = categoryData.filter(function (category) {
|
||||
return category && !category.link;
|
||||
});
|
||||
categoryData = categoryData.filter(category => category && !category.link);
|
||||
var selectedCategory = [];
|
||||
var selectedCids = [];
|
||||
categoryData.forEach(function (category) {
|
||||
@@ -272,12 +270,10 @@ function getCategoryData(cids, uid, selectedCid, callback) {
|
||||
category.parentCid = category.hasOwnProperty('parentCid') && utils.isNumber(category.parentCid) ? category.parentCid : 0;
|
||||
if (category.selected) {
|
||||
selectedCategory.push(category);
|
||||
selectedCids.push(parseInt(category.cid, 10));
|
||||
selectedCids.push(category.cid);
|
||||
}
|
||||
});
|
||||
selectedCids.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
selectedCids.sort((a, b) => a - b);
|
||||
|
||||
if (selectedCategory.length > 1) {
|
||||
selectedCategory = {
|
||||
|
||||
Reference in New Issue
Block a user