mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
prevent hax voting via websockets if system disabled
This commit is contained in:
@@ -98,10 +98,18 @@ var async = require('async'),
|
||||
}
|
||||
|
||||
Favourites.upvote = function(pid, uid, callback) {
|
||||
if (meta.config['votingEnabled'] === false) {
|
||||
return callback(false);
|
||||
}
|
||||
|
||||
toggleVote('upvote', pid, uid, callback);
|
||||
};
|
||||
|
||||
Favourites.downvote = function(pid, uid, callback) {
|
||||
if (meta.config['votingEnabled'] === false) {
|
||||
return callback(false);
|
||||
}
|
||||
|
||||
user.getUserField(uid, 'reputation', function(err, reputation) {
|
||||
if (reputation < meta.config['privileges:downvote']) {
|
||||
return callback(new Error('[[error:not-enough-reputation-to-downvote]]'));
|
||||
|
||||
Reference in New Issue
Block a user