From 7f713ee8220a633ddc4ac63a2a8082ab39c10ba9 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 17 Mar 2017 13:08:47 -0500 Subject: [PATCH 1/3] Admin option to allow all users to view votes (#5534) * Admin option to allow all users to view votes * Fix --- public/language/en-GB/admin/settings/reputation.json | 1 + src/socket.io/posts/votes.js | 4 ++++ src/views/admin/settings/reputation.tpl | 10 ++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/public/language/en-GB/admin/settings/reputation.json b/public/language/en-GB/admin/settings/reputation.json index 11d6184721..f0e59e8db9 100644 --- a/public/language/en-GB/admin/settings/reputation.json +++ b/public/language/en-GB/admin/settings/reputation.json @@ -2,6 +2,7 @@ "reputation": "Reputation Settings", "disable": "Disable Reputation System", "disable-down-voting": "Disable Down Voting", + "votes-are-public": "All Votes Are Public", "thresholds": "Activity Thresholds", "min-rep-downvote": "Minimum reputation to downvote posts", "min-rep-flag": "Minimum reputation to flag posts" diff --git a/src/socket.io/posts/votes.js b/src/socket.io/posts/votes.js index 0c12fe262d..3e65964343 100644 --- a/src/socket.io/posts/votes.js +++ b/src/socket.io/posts/votes.js @@ -6,6 +6,7 @@ var db = require('../../database'); var user = require('../../user'); var posts = require('../../posts'); var privileges = require('../../privileges'); +var meta = require('../../meta'); var helpers = require('./helpers'); module.exports = function (SocketPosts) { @@ -16,6 +17,9 @@ module.exports = function (SocketPosts) { async.waterfall([ function (next) { + if (parseInt(meta.config.votesArePublic, 10) !== 0) { + return next(null, true); + } privileges.categories.isAdminOrMod(data.cid, socket.uid, next); }, function (isAdminOrMod, next) { diff --git a/src/views/admin/settings/reputation.tpl b/src/views/admin/settings/reputation.tpl index 907fa90190..aee71910d4 100644 --- a/src/views/admin/settings/reputation.tpl +++ b/src/views/admin/settings/reputation.tpl @@ -14,7 +14,13 @@
+
+
+
@@ -32,4 +38,4 @@ - \ No newline at end of file + From 9714e3c26b3d0ed1c10887380caf379d194a416c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 21 Mar 2017 14:01:41 -0400 Subject: [PATCH 2/3] Up MongoDB dependency to v2.2.25 This is a PR to see if tests go :boom: --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc0d1e62d8..447036128f 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "mime": "^1.3.4", "minimist": "^1.1.1", "mkdirp": "~0.5.0", - "mongodb": "2.2.16", + "mongodb": "2.2.25", "morgan": "^1.3.2", "mousetrap": "^1.5.3", "nconf": "~0.8.2", From b6134b160e3cf06e86f661f93585966902fec28e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 21 Mar 2017 15:55:24 -0400 Subject: [PATCH 3/3] moved auto_reconnect out of socketOptions object for Mongo --- src/database/mongo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/database/mongo.js b/src/database/mongo.js index 8e6494ffd7..dcf1f69e31 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -79,9 +79,10 @@ var connOptions = { server: { poolSize: parseInt(nconf.get('mongo:poolSize'), 10) || 10, - socketOptions: { autoReconnect: true, keepAlive: nconf.get('mongo:keepAlive') || 0 }, + socketOptions: { keepAlive: nconf.get('mongo:keepAlive') || 0 }, reconnectTries: 3600, reconnectInterval: 1000, + auto_reconnect: true, }, };