From c62f251afc96b4d3b26a2bf6eda6663bf17bc9a9 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 4 Sep 2014 01:48:57 -0400 Subject: [PATCH] added index and fixed vote button in infinite scroll --- src/database/mongo.js | 6 ++++++ src/socket.io/topics.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/database/mongo.js b/src/database/mongo.js index 455ef87190..58a1ea310f 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -90,6 +90,12 @@ } }); + db.collection('objects').ensureIndex({_key :1, score: 1}, {background:true}, function(err) { + if(err) { + winston.error('Error creating index ' + err.message); + } + }); + db.collection('objects').ensureIndex({_key :1, value: -1}, {background:true}, function(err) { if(err) { winston.error('Error creating index ' + err.message); diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index 0b1c308bb8..2f09cbe68f 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -456,6 +456,9 @@ SocketTopics.loadMore = function(socket, data, callback) { }, 'reputation:disabled': function(next) { next(null, parseInt(meta.config['reputation:disabled'], 10) === 1); + }, + 'downvote:disabled': function(next) { + next(null, parseInt(meta.config['downvote:disabled'], 10) === 1); } }, callback); });