mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
partially revert fa9f1ac7fe
extending module.exports instead of overwriting fixes the issue
This commit is contained in:
@@ -3,7 +3,12 @@
|
||||
|
||||
var async = require('async');
|
||||
|
||||
var meta = require('../meta');
|
||||
var posts = require('../posts');
|
||||
var topics = require('../topics');
|
||||
var user = require('../user');
|
||||
var helpers = require('./helpers');
|
||||
var plugins = require('../plugins');
|
||||
|
||||
module.exports = function(privileges) {
|
||||
|
||||
@@ -13,8 +18,7 @@ module.exports = function(privileges) {
|
||||
if (!Array.isArray(pids) || !pids.length) {
|
||||
return callback(null, []);
|
||||
}
|
||||
var posts = require('../posts');
|
||||
var user = require('../user');
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
posts.getCidsByPids(pids, next);
|
||||
@@ -55,7 +59,6 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
privileges.posts.can = function(privilege, pid, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
posts.getCidByPid(pid, function(err, cid) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@@ -66,8 +69,6 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
privileges.posts.filter = function(privilege, pids, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
var topics = require('../topics');
|
||||
if (!Array.isArray(pids) || !pids.length) {
|
||||
return callback(null, []);
|
||||
}
|
||||
@@ -126,7 +127,6 @@ module.exports = function(privileges) {
|
||||
return post.pid;
|
||||
});
|
||||
|
||||
var plugins = require('../plugins');
|
||||
plugins.fireHook('filter:privileges.posts.filter', {
|
||||
privilege: privilege,
|
||||
uid: uid,
|
||||
@@ -155,12 +155,7 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
privileges.posts.canDelete = function(pid, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
var topics = require('../topics');
|
||||
var meta = require('../meta');
|
||||
|
||||
var postData;
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
posts.getPostFields(pid, ['tid', 'timestamp'], next);
|
||||
@@ -201,7 +196,6 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
privileges.posts.canMove = function(pid, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
posts.isMain(pid, function(err, isMain) {
|
||||
if (err || isMain) {
|
||||
return callback(err || new Error('[[error:cant-move-mainpost]]'));
|
||||
@@ -211,7 +205,6 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
privileges.posts.canPurge = function(pid, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
posts.getCidByPid(pid, next);
|
||||
@@ -230,10 +223,6 @@ module.exports = function(privileges) {
|
||||
};
|
||||
|
||||
function isPostEditable(pid, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
var topics = require('../topics');
|
||||
var meta = require('../meta');
|
||||
|
||||
var tid;
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
@@ -264,8 +253,6 @@ module.exports = function(privileges) {
|
||||
}
|
||||
|
||||
function isAdminOrMod(pid, uid, callback) {
|
||||
var posts = require('../posts');
|
||||
var user = require('../user');
|
||||
helpers.some([
|
||||
function(next) {
|
||||
posts.getCidByPid(pid, function(err, cid) {
|
||||
@@ -281,4 +268,4 @@ module.exports = function(privileges) {
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user