mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-06 15:42:52 +01:00
prevent a user from downvoting if at negative rep
This commit is contained in:
@@ -101,7 +101,13 @@ var async = require('async'),
|
||||
};
|
||||
|
||||
Favourites.downvote = function(pid, uid, callback) {
|
||||
toggleVote('downvote', pid, uid, callback);
|
||||
user.getUserField(uid, 'reputation', function(err, reputation) {
|
||||
if (reputation < 0) {
|
||||
return callback(new Error('[[error:not-enough-reputation-to-downvote]]'));
|
||||
}
|
||||
|
||||
toggleVote('downvote', pid, uid, callback);
|
||||
});
|
||||
};
|
||||
|
||||
function toggleVote(type, pid, uid, callback) {
|
||||
|
||||
Reference in New Issue
Block a user