mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
linting, TIL that obj.$key is valid syntax
This commit is contained in:
@@ -110,7 +110,7 @@ module.exports = function(db, module) {
|
||||
|
||||
var fields = {_id: 0, value: 1};
|
||||
if (withScores) {
|
||||
fields['score'] = 1;
|
||||
fields.score = 1;
|
||||
}
|
||||
db.collection('objects').find({_key:key}, {fields: fields})
|
||||
.limit(stop - start + 1)
|
||||
@@ -165,15 +165,15 @@ module.exports = function(db, module) {
|
||||
|
||||
var scoreQuery = {};
|
||||
if (min !== -Infinity) {
|
||||
scoreQuery['$gte'] = min;
|
||||
scoreQuery.$gte = min;
|
||||
}
|
||||
if (max !== Infinity) {
|
||||
scoreQuery['$lte'] = max;
|
||||
scoreQuery.$lte = max;
|
||||
}
|
||||
|
||||
var fields = {_id: 0, value: 1};
|
||||
if (withScores) {
|
||||
fields['score'] = 1;
|
||||
fields.score = 1;
|
||||
}
|
||||
|
||||
db.collection('objects').find({_key:key, score: scoreQuery}, {fields: fields})
|
||||
@@ -440,7 +440,7 @@ module.exports = function(db, module) {
|
||||
}
|
||||
var data = {};
|
||||
value = helpers.fieldToString(value);
|
||||
data['score'] = parseInt(increment, 10);
|
||||
data.score = parseInt(increment, 10);
|
||||
|
||||
db.collection('objects').findAndModify({_key: key, value: value}, {}, {$inc: data}, {new:true, upsert:true}, function(err, result) {
|
||||
callback(err, result ? result[value] : null);
|
||||
|
||||
@@ -78,7 +78,9 @@
|
||||
var redis_socket_or_host = nconf.get('redis:host'),
|
||||
cxn, dbIdx;
|
||||
|
||||
if (!redis) redis = require('redis');
|
||||
if (!redis) {
|
||||
redis = require('redis');
|
||||
}
|
||||
|
||||
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
|
||||
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
||||
|
||||
@@ -30,8 +30,9 @@ var utils = require('./../../public/src/utils'),
|
||||
var middleware = {};
|
||||
|
||||
function routeCurrentTheme(app, themeId, themesData) {
|
||||
var themeId = (themeId || 'nodebb-theme-vanilla'),
|
||||
themeObj = (function(id) {
|
||||
themeId = (themeId || 'nodebb-theme-vanilla');
|
||||
|
||||
var themeObj = (function(id) {
|
||||
return themesData.filter(function(themeObj) {
|
||||
return themeObj.id === id;
|
||||
})[0];
|
||||
|
||||
Reference in New Issue
Block a user