mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
closes #2028
This commit is contained in:
@@ -79,6 +79,7 @@
|
|||||||
"reputation-system-disabled": "Reputation system is disabled.",
|
"reputation-system-disabled": "Reputation system is disabled.",
|
||||||
"downvoting-disabled": "Downvoting is disabled",
|
"downvoting-disabled": "Downvoting is disabled",
|
||||||
"not-enough-reputation-to-downvote": "You do not have enough reputation to downvote this post",
|
"not-enough-reputation-to-downvote": "You do not have enough reputation to downvote this post",
|
||||||
|
"not-enough-reputation-to-flag": "Yo do not have enough reputation to flag 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."
|
"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."
|
||||||
}
|
}
|
||||||
@@ -276,16 +276,22 @@ SocketPosts.flag = function(socket, pid, callback) {
|
|||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
user.getUserField(socket.uid, 'username', next);
|
user.getUserFields(socket.uid, ['username', 'reputation'], next);
|
||||||
},
|
},
|
||||||
function(username, next) {
|
function(userData, next) {
|
||||||
message = '[[notifications:user_flagged_post, ' + username + ']]';
|
if (parseInt(userData.reputation, 10) < parseInt(meta.config['privileges:flag'] || 1, 10)) {
|
||||||
|
return next(new Error('[[error:not-enough-reputation-to-flag]]'));
|
||||||
|
}
|
||||||
|
message = '[[notifications:user_flagged_post, ' + userData.username + ']]';
|
||||||
posts.getPostFields(pid, ['tid', 'uid', 'content'], next);
|
posts.getPostFields(pid, ['tid', 'uid', 'content'], next);
|
||||||
},
|
},
|
||||||
function(postData, next) {
|
function(postData, next) {
|
||||||
postTools.parse(postData.content, function(err, parsed) {
|
postTools.parse(postData.content, function(err, parsed) {
|
||||||
|
if (err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
postData.content = parsed;
|
postData.content = parsed;
|
||||||
next(undefined, postData);
|
next(null, postData);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(postData, next) {
|
function(postData, next) {
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ module.exports = function(Topics) {
|
|||||||
|
|
||||||
for (var i = 0; i < postData.length; ++i) {
|
for (var i = 0; i < postData.length; ++i) {
|
||||||
if (postData[i]) {
|
if (postData[i]) {
|
||||||
|
postData[i].index = results.indices[i];
|
||||||
postData[i].deleted = parseInt(postData[i].deleted, 10) === 1;
|
postData[i].deleted = parseInt(postData[i].deleted, 10) === 1;
|
||||||
postData[i].user = results.userData[postData[i].uid];
|
postData[i].user = results.userData[postData[i].uid];
|
||||||
postData[i].editor = postData[i].editor ? results.editors[postData[i].editor] : null;
|
postData[i].editor = postData[i].editor ? results.editors[postData[i].editor] : null;
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ var async = require('async'),
|
|||||||
posts = require('../posts'),
|
posts = require('../posts'),
|
||||||
postTools = require('../postTools'),
|
postTools = require('../postTools'),
|
||||||
topics = require('../topics'),
|
topics = require('../topics'),
|
||||||
privileges = require('../privileges');
|
privileges = require('../privileges'),
|
||||||
|
utils = require('../../public/src/utils');
|
||||||
|
|
||||||
(function(UserNotifications) {
|
(function(UserNotifications) {
|
||||||
|
|
||||||
@@ -186,7 +187,8 @@ var async = require('async'),
|
|||||||
var paths = [];
|
var paths = [];
|
||||||
pids.forEach(function(pid, index) {
|
pids.forEach(function(pid, index) {
|
||||||
var slug = results.topics[index] ? results.topics[index].slug : null;
|
var slug = results.topics[index] ? results.topics[index].slug : null;
|
||||||
var postIndex = results.indices[index] ? parseInt(results.indices[index], 10) + 1 : null;
|
var postIndex = utils.isNumber(results.indices[index]) ? parseInt(results.indices[index], 10) + 1 : null;
|
||||||
|
|
||||||
if (slug && postIndex) {
|
if (slug && postIndex) {
|
||||||
paths.push(nconf.get('relative_path') + '/topic/' + slug + '/' + postIndex);
|
paths.push(nconf.get('relative_path') + '/topic/' + slug + '/' + postIndex);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user