prevent a user from downvoting if at negative rep

v1.18.x
psychobunny 11 years ago
parent 6685e140c3
commit 8a03b42d62

@ -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) {

Loading…
Cancel
Save