mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
refactored topic locking pinning and deleting (and its inverses) so that the privilege check is done not in the method, but in the socket call
This commit is contained in:
@@ -142,7 +142,7 @@ var RDB = require('./redis.js'),
|
||||
// Delete the thread if it is the last undeleted post
|
||||
threadTools.getLatestUndeletedPid(postData.tid, function(err, pid) {
|
||||
if (err && err.message === 'no-undeleted-pids-found') {
|
||||
threadTools.delete(postData.tid, -1, function(err) {
|
||||
threadTools.delete(postData.tid, function(err) {
|
||||
if (err) {
|
||||
winston.error('Could not delete topic (tid: ' + postData.tid + ')', err.stack);
|
||||
}
|
||||
@@ -163,14 +163,14 @@ var RDB = require('./redis.js'),
|
||||
|
||||
posts.getPostField(pid, 'deleted', function(err, deleted) {
|
||||
if(deleted === '1') {
|
||||
return callback(new Error('Post already deleted!'));
|
||||
return callback(new Error('Post already deleted!'));
|
||||
}
|
||||
|
||||
|
||||
PostTools.privileges(pid, uid, function(privileges) {
|
||||
if (privileges.editable) {
|
||||
success();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@@ -210,8 +210,8 @@ var RDB = require('./redis.js'),
|
||||
posts.getPostField(pid, 'deleted', function(err, deleted) {
|
||||
if(deleted === '0') {
|
||||
return callback(new Error('Post already restored'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PostTools.privileges(pid, uid, function(privileges) {
|
||||
if (privileges.editable) {
|
||||
success();
|
||||
|
||||
Reference in New Issue
Block a user