Node.js based forum software built for the modern web
fix: allow guests to load topic tools if they have privilege to view them
Barış Soner Uşaklı78de8c6da129
diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.jsindex a83a9d86b5..7a2519b069 100644--- a/public/src/client/topic/threadTools.js+++ b/public/src/client/topic/threadTools.js@@ -225,7 +225,7 @@ define('forum/topic/threadTools', [return;}dropdownMenu.html(helpers.generatePlaceholderWave([8, 8, 8]));- const data = await socket.emit('topics.loadTopicTools', { tid: ajaxify.data.tid, cid: ajaxify.data.cid });+ const data = await socket.emit('topics.loadTopicTools', { tid: ajaxify.data.tid, cid: ajaxify.data.cid }).catch(alerts.error);const html = await app.parseAndTranslate('partials/topic/topic-menu-list', data);$(dropdownMenu).attr('data-loaded', 'true').html(html);hooks.fire('action:topic.tools.load', {diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.jsindex 80bab41662..e4044a5272 100644--- a/src/socket.io/topics/tools.js+++ b/src/socket.io/topics/tools.js@@ -6,9 +6,6 @@ const plugins = require('../../plugins');module.exports = function (SocketTopics) {SocketTopics.loadTopicTools = async function (socket, data) {- if (!socket.uid) {- throw new Error('[[error:no-privileges]]');- }if (!data) {throw new Error('[[error:invalid-data]]');}@@ -21,7 +18,7 @@ module.exports = function (SocketTopics) {if (!topicData) {throw new Error('[[error:no-topic]]');}- if (!userPrivileges['topics:read']) {+ if (!userPrivileges['topics:read'] || !userPrivileges.view_thread_tools) {throw new Error('[[error:no-privileges]]');}topicData.privileges = userPrivileges;