mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closes #1934
This commit is contained in:
@@ -76,6 +76,8 @@
|
||||
|
||||
"cant-chat-with-yourself": "You can't chat with yourself!",
|
||||
|
||||
"reputation-system-disabled": "Reputation system is disabled.",
|
||||
"downvoting-disabled": "Downvoting is disabled",
|
||||
"not-enough-reputation-to-downvote": "You do not have enough reputation to downvote this post",
|
||||
|
||||
"reload-failed": "NodeBB encountered a problem while reloading: \"%1\". NodeBB will continue to serve the existing client-side assets, although you should undo what you did just prior to reloading."
|
||||
|
||||
@@ -184,8 +184,9 @@ topicsController.get = function(req, res, next) {
|
||||
}
|
||||
|
||||
data.privileges = userPrivileges;
|
||||
data['reputation:disabled'] = meta.config['reputation:disabled'] === '1' ? true : false;
|
||||
data['feeds:disableRSS'] = meta.config['feeds:disableRSS'] === '1' ? true : false;
|
||||
data['reputation:disabled'] = parseInt(meta.config['reputation:disabled'], 10) === 1;
|
||||
data['downvote:disabled'] = parseInt(meta.config['downvote:disabled'], 10) === 1;
|
||||
data['feeds:disableRSS'] = parseInt(meta.config['feeds:disableRSS'], 10) === 1;
|
||||
|
||||
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
|
||||
var queryString = qs.stringify(req.query);
|
||||
|
||||
@@ -98,20 +98,28 @@ var async = require('async'),
|
||||
}
|
||||
|
||||
Favourites.upvote = function(pid, uid, callback) {
|
||||
if (meta.config['reputation:disabled'] === false) {
|
||||
return callback(false);
|
||||
if (parseInt(meta.config['reputation:disabled'], 10) === 1) {
|
||||
return callback(new Error('[[error:reputation-system-disabled]]'));
|
||||
}
|
||||
|
||||
toggleVote('upvote', pid, uid, callback);
|
||||
};
|
||||
|
||||
Favourites.downvote = function(pid, uid, callback) {
|
||||
if (meta.config['reputation:disabled'] === false) {
|
||||
return callback(false);
|
||||
if (parseInt(meta.config['reputation:disabled'], 10) === 1) {
|
||||
return callback(new Error('[[error:reputation-system-disabled]]'));
|
||||
}
|
||||
|
||||
if (parseInt(meta.config['downvote:disabled'], 10) === 1) {
|
||||
return callback(new Error('[[error:downvoting-disabled]]'));
|
||||
}
|
||||
|
||||
user.getUserField(uid, 'reputation', function(err, reputation) {
|
||||
if (reputation < meta.config['privileges:downvote']) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (reputation < parseInt(meta.config['privileges:downvote'], 10)) {
|
||||
return callback(new Error('[[error:not-enough-reputation-to-downvote]]'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user