mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
This commit is contained in:
@@ -191,6 +191,9 @@ module.exports = function(privileges) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
privileges.categories.isAdminOrMod = function(cid, uid, callback) {
|
privileges.categories.isAdminOrMod = function(cid, uid, callback) {
|
||||||
|
if (!parseInt(uid, 10)) {
|
||||||
|
return callback(null, false);
|
||||||
|
}
|
||||||
helpers.some([
|
helpers.some([
|
||||||
function (next) {
|
function (next) {
|
||||||
user.isModerator(uid, cid, next);
|
user.isModerator(uid, cid, next);
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ var favourites = require('../../favourites');
|
|||||||
module.exports = function(SocketPosts) {
|
module.exports = function(SocketPosts) {
|
||||||
|
|
||||||
SocketPosts.loadPostTools = function(socket, data, callback) {
|
SocketPosts.loadPostTools = function(socket, data, callback) {
|
||||||
if (!socket.uid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return callback(new Error('[[error:invalid-data]]'))
|
return callback(new Error('[[error:invalid-data]]'))
|
||||||
}
|
}
|
||||||
@@ -37,7 +34,7 @@ module.exports = function(SocketPosts) {
|
|||||||
results.posts.tools = []; // TODO: add filter for this
|
results.posts.tools = []; // TODO: add filter for this
|
||||||
results.posts.deleted = parseInt(results.posts.deleted, 10) === 1;
|
results.posts.deleted = parseInt(results.posts.deleted, 10) === 1;
|
||||||
results.posts.favourited = results.favourited[0];
|
results.posts.favourited = results.favourited[0];
|
||||||
results.posts.selfPost = socket.uid === parseInt(results.posts.uid, 10);
|
results.posts.selfPost = socket.uid && socket.uid === parseInt(results.posts.uid, 10);
|
||||||
results.posts.display_moderator_tools = results.isAdminOrMod || results.posts.selfPost;
|
results.posts.display_moderator_tools = results.isAdminOrMod || results.posts.selfPost;
|
||||||
results.posts.display_move_tools = results.isAdminOrMod;
|
results.posts.display_move_tools = results.isAdminOrMod;
|
||||||
callback(null, results);
|
callback(null, results);
|
||||||
|
|||||||
Reference in New Issue
Block a user