Node.js based forum software built for the modern web
handling case where user does not satisfy any of the privilege thresholds given to the hasEnoughReputationFor method
Julian Lam44175188c447
diff --git a/src/controllers/topics.js b/src/controllers/topics.jsindex b094cf5426..8596803ca2 100644--- a/src/controllers/topics.js+++ b/src/controllers/topics.js@@ -40,7 +40,6 @@ topicsController.get = function(req, res, next) {}, next);},function (results, next) {-userPrivileges = results.privileges;if (userPrivileges.disabled) {diff --git a/src/privileges/helpers.js b/src/privileges/helpers.jsindex 72afd32aae..e4f765057f 100644--- a/src/privileges/helpers.js+++ b/src/privileges/helpers.js@@ -140,6 +140,9 @@ helpers.hasEnoughReputationFor = function(privilege, uid, callback) {return callback(null, true);}}++ // Does not satisfy any of those thresholds?+ return callback(null, false);} else {callback(null, reputation >= parseInt(meta.config[privilege], 10));}diff --git a/src/topics.js b/src/topics.jsindex b1bfcdeeaa..d90d6aefde 100644--- a/src/topics.js+++ b/src/topics.js@@ -265,6 +265,7 @@ var async = require('async'),}pids = topicData.mainPid ? [topicData.mainPid].concat(pids) : pids;+if (!pids.length) {return next(null, []);}@@ -277,18 +278,10 @@ var async = require('async'),});});},- category: function(next) {- Topics.getCategoryData(tid, next);- },- threadTools: function(next) {- plugins.fireHook('filter:topic.thread_tools', [], next);- },- tags: function(next) {- Topics.getTopicTagsObjects(tid, next);- },- isFollowing: function(next) {- Topics.isFollowing(tid, uid, next);- }+ category: async.apply(Topics.getCategoryData, tid),+ threadTools: async.apply(plugins.fireHook, 'filter:topic.thread_tools', []),+ tags: async.apply(Topics.getTopicTagsObjects, tid),+ isFollowing: async.apply(Topics.isFollowing, tid, uid)}, function(err, results) {if (err) {return callback(err);