mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-05 13:27:40 +02:00
Merge branch '0.5.1' into csrf-excision
This commit is contained in:
@@ -105,6 +105,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
db.collection('search').ensureIndex({key: 1, id: 1}, {background: true}, function(err) {
|
||||
if(err) {
|
||||
winston.error('Error creating index ' + err.message);
|
||||
}
|
||||
});
|
||||
|
||||
if(typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = function(db, module) {
|
||||
content: content
|
||||
};
|
||||
|
||||
db.collection('search').update({id:id, key:key}, {$set:data}, {upsert:true, w: 1}, function(err) {
|
||||
db.collection('search').update({key:key, id:id}, {$set:data}, {upsert:true, w: 1}, function(err) {
|
||||
if(err) {
|
||||
winston.error('Error indexing ' + err.message);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ module.exports = function(db, module) {
|
||||
|
||||
module.searchRemove = function(key, id, callback) {
|
||||
callback = callback || helpers.noop;
|
||||
db.collection('search').remove({id:id, key:key}, callback);
|
||||
db.collection('search').remove({key:key, id:id}, callback);
|
||||
};
|
||||
|
||||
module.flushdb = function(callback) {
|
||||
|
||||
@@ -44,6 +44,13 @@ var async = require('async'),
|
||||
|
||||
db.sortedSetAdd('users:reputation', newreputation, postData.uid);
|
||||
|
||||
if (parseInt(meta.config['autoban:downvote'], 10) === 1 && newreputation < parseInt(meta.config['autoban:downvote:threshold'], 10)) {
|
||||
var adminUser = require('./socket.io/admin/user');
|
||||
adminUser.banUser(postData.uid, function() {
|
||||
require('winston').info('uid ' + uid + ' was banned for reaching ' + newreputation + ' reputation');
|
||||
});
|
||||
}
|
||||
|
||||
adjustPostVotes(pid, uid, type, unvote, function(err, votes) {
|
||||
postData.votes = votes;
|
||||
callback(err, {
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = function(User) {
|
||||
|
||||
User.auth.resetLockout = function(uid, callback) {
|
||||
async.parallel([
|
||||
async.apply(db.delete, 'loginAttemps:' + uid),
|
||||
async.apply(db.delete, 'loginAttempts:' + uid),
|
||||
async.apply(db.delete, 'lockout:' + uid)
|
||||
], callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user