early outs for privs

no need to check if empty array is passed in, happens if there are no
unread topics
remove dupe cids before checking for privileges
This commit is contained in:
barisusakli
2014-07-31 17:29:20 -04:00
parent 7bfec99df1
commit 1398937dd8
3 changed files with 15 additions and 0 deletions

View File

@@ -77,6 +77,9 @@ module.exports = function(privileges) {
};
privileges.posts.filter = function(privilege, pids, uid, callback) {
if (!pids.length) {
return callback(null, []);
}
posts.getCidsByPids(pids, function(err, cids) {
if (err) {
return callback(err);