Node.js based forum software built for the modern web
check if we have edit permission on the pids that we want to move
Baris Soner Usaklifaf5ea2122db
diff --git a/src/postTools.js b/src/postTools.jsindex 48ef0ae221..2fa9d45485 100644--- a/src/postTools.js+++ b/src/postTools.js@@ -27,7 +27,7 @@ var winston = require('winston'),}PostTools.privileges = function(pid, uid, callback) {- if(uid == 0) {+ if(parseInt(uid, 10) === 0) {callback({editable: false,view_deleted: false@@ -52,7 +52,9 @@ var winston = require('winston'),return next(null, false);} else {user.getUserField(uid, 'reputation', function(err, reputation) {- if (err) return next(null, false);+ if (err) {+ return next(null, false);+ }next(null, parseInt(reputation, 10) >= parseInt(meta.config['privileges:manage_content'], 10));});}diff --git a/src/topics.js b/src/topics.jsindex 8215d19f26..b5ed978d98 100644--- a/src/topics.js+++ b/src/topics.js@@ -214,9 +214,6 @@ var async = require('async'),pids.sort();var mainPid = pids[0];- //TODO: check if we can move all the pids, threadTools privs? -baris--posts.getPostData(mainPid, function(err, postData) {if(err) {return callback(err);@@ -243,12 +240,18 @@ var async = require('async'),});function move(pid, next) {- posts.getPostField(pid, 'timestamp', function(err, timestamp) {- if(err) {- return next(err);+ postTools.privileges(pid, uid, function(privileges) {+ if(privileges.editable) {+ posts.getPostField(pid, 'timestamp', function(err, timestamp) {+ if(err) {+ return next(err);+ }++ Topics.movePostToTopic(pid, postData.tid, tid, timestamp, next);+ });+ } else {+ next();}-- Topics.movePostToTopic(pid, postData.tid, tid, timestamp, next);});}});