This commit is contained in:
Baris Soner Usakli
2014-02-19 13:30:39 -05:00
3 changed files with 11 additions and 16 deletions

View File

@@ -13,16 +13,14 @@
expand: options.expand
}, next);
}, function (err, groups) {
groups.forEach(function(group, g, arr) {
if (parseInt(group.deleted, 10) === 1) {
delete arr[g];
// Remove deleted and hidden groups from this list
callback(err, groups.filter(function (group) {
if (parseInt(group.deleted, 10) === 1 || parseInt(group.hidden, 10) === 1) {
return false;
} else {
return true;
}
if (parseInt(group.hidden, 10) === 1) {
group.deletable = 0;
}
});
callback(err, groups);
}));
});
} else {
callback(null, []);