Merge remote-tracking branch 'origin/0.5.1' into cluster

v1.18.x
barisusakli 11 years ago
commit c8692f0562

@ -108,6 +108,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') { if(typeof callback === 'function') {
callback(); callback();
} }

@ -13,7 +13,7 @@ module.exports = function(db, module) {
content: content 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) { if(err) {
winston.error('Error indexing ' + err.message); winston.error('Error indexing ' + err.message);
} }
@ -41,7 +41,7 @@ module.exports = function(db, module) {
module.searchRemove = function(key, id, callback) { module.searchRemove = function(key, id, callback) {
callback = callback || helpers.noop; 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) { module.flushdb = function(callback) {

@ -131,7 +131,14 @@ var async = require('async'),
return callback(new Error('[[error:not-enough-reputation-to-downvote]]')); return callback(new Error('[[error:not-enough-reputation-to-downvote]]'));
} }
toggleVote('downvote', pid, uid, callback); toggleVote('downvote', pid, uid, function(err, votes) {
if (err) return callback(err);
plugins.fireHook('action:post.downvote', {
pid: pid,
uid: uid
});
callback(null, votes);
});
}); });
}; };

Loading…
Cancel
Save