mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-09 00:36:34 +02:00
fixed bug in privilege settings where categories near the end of a list were not having their permissions read properly if earlier categories were disabled, #2887
This commit is contained in:
@@ -101,18 +101,19 @@ module.exports = function(privileges) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
cids = cids.filter(function(cid, index) {
|
||||
return !results.categories[index].disabled;
|
||||
cids = cids.map(function(cid, index) {
|
||||
return !results.categories[index].disabled ? cid : null;
|
||||
});
|
||||
|
||||
if (results.isAdmin) {
|
||||
return callback(null, cids);
|
||||
return callback(null, cids.filter(Boolean));
|
||||
}
|
||||
|
||||
cids = cids.filter(function(cid, index) {
|
||||
return results.allowedTo[index] || results.isModerators[index];
|
||||
cids = cids.map(function(cid, index) {
|
||||
return (results.allowedTo[index] || results.isModerators[index]) ? cid : null;
|
||||
});
|
||||
callback(null, cids);
|
||||
|
||||
callback(null, cids.filter(Boolean));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user