Skip to content

Node.js based forum software built for the modern web

closes https://github.com/NodeBB/nodebb-theme-persona/issues/181

barisusakli47c71b5a372b
diff --git a/src/privileges/categories.js b/src/privileges/categories.js
index 31d1deeeb3..d51edbb9a8 100644
--- a/src/privileges/categories.js
+++ b/src/privileges/categories.js
@@ -191,6 +191,9 @@ module.exports = function(privileges) {
};
privileges.categories.isAdminOrMod = function(cid, uid, callback) {
+ if (!parseInt(uid, 10)) {
+ return callback(null, false);
+ }
helpers.some([
function (next) {
user.isModerator(uid, cid, next);
diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js
index fc4491ea44..d05c2b74be 100644
--- a/src/socket.io/posts/tools.js
+++ b/src/socket.io/posts/tools.js
@@ -13,9 +13,6 @@ var favourites = require('../../favourites');
module.exports = function(SocketPosts) {
SocketPosts.loadPostTools = function(socket, data, callback) {
- if (!socket.uid) {
- return;
- }
if (!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.deleted = parseInt(results.posts.deleted, 10) === 1;
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_move_tools = results.isAdminOrMod;
callback(null, results);