Node.js based forum software built for the modern web
closes #6146
Barış Soner Uşaklıd9e115c3e63c
diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.jsonindex c336b8129e..2a0d99f45f 100644--- a/public/language/en-GB/error.json+++ b/public/language/en-GB/error.json@@ -163,5 +163,7 @@"invalid-home-page-route": "Invalid home page route","invalid-session": "Session Mismatch",- "invalid-session-text": "It looks like your login session is no longer active, or no longer matches with the server. Please refresh this page."+ "invalid-session-text": "It looks like your login session is no longer active, or no longer matches with the server. Please refresh this page.",++ "no-topics-selected": "No topics selected!"}diff --git a/public/language/en-GB/topic.json b/public/language/en-GB/topic.jsonindex 40b9b84d09..39d2811931 100644--- a/public/language/en-GB/topic.json+++ b/public/language/en-GB/topic.json@@ -6,8 +6,6 @@"no_topics_found": "No topics found!","no_posts_found": "No posts found!",- "no_topics_selected": "No topics selected!",-"post_is_deleted": "This post is deleted!","topic_is_deleted": "This topic is deleted!",diff --git a/public/src/client/category/tools.js b/public/src/client/category/tools.jsindex c245dadc44..dfa31ca86a 100644--- a/public/src/client/category/tools.js+++ b/public/src/client/category/tools.js@@ -35,60 +35,65 @@ define('forum/category/tools', [components.get('topic/lock').on('click', function () {var tids = topicSelect.getSelectedTids();- if (tids.length) {- socket.emit('topics.lock', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);+ if (!tids.length) {+ return app.alertError('[[error:no-topics-selected]]');}+ socket.emit('topics.lock', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);return false;});components.get('topic/unlock').on('click', function () {var tids = topicSelect.getSelectedTids();- if (tids.length) {- socket.emit('topics.unlock', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);+ if (!tids.length) {+ return app.alertError('[[error:no-topics-selected]]');}+ socket.emit('topics.unlock', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);return false;});components.get('topic/pin').on('click', function () {var tids = topicSelect.getSelectedTids();- if (tids.length) {- socket.emit('topics.pin', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);+ if (!tids.length) {+ return app.alertError('[[error:no-topics-selected]]');}+ socket.emit('topics.pin', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);return false;});components.get('topic/unpin').on('click', function () {var tids = topicSelect.getSelectedTids();- if (tids.length) {- socket.emit('topics.unpin', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);+ if (!tids.length) {+ return app.alertError('[[error:no-topics-selected]]');}+ socket.emit('topics.unpin', { tids: tids, cid: CategoryTools.cid }, onCommandComplete);return false;});components.get('topic/mark-unread-for-all').on('click', function () {var tids = topicSelect.getSelectedTids();- if (tids.length) {- socket.emit('topics.markAsUnreadForAll', tids, function (err) {- if (err) {- return app.alertError(err.message);- }- app.alertSuccess('[[topic:markAsUnreadForAll.success]]');- tids.forEach(function (tid) {- $('[component="category/topic"][data-tid="' + tid + '"]').addClass('unread');- });- onCommandComplete();- });+ if (!tids.length) {+ return app.alertError('[[error:no-topics-selected]]');}-+ socket.emit('topics.markAsUnreadForAll', tids, function (err) {+ if (err) {+ return app.alertError(err.message);+ }+ app.alertSuccess('[[topic:markAsUnreadForAll.success]]');+ tids.forEach(function (tid) {+ $('[component="category/topic"][data-tid="' + tid + '"]').addClass('unread');+ });+ onCommandComplete();+ });return false;});components.get('topic/move').on('click', function () {var tids = topicSelect.getSelectedTids();- if (tids.length) {- move.init(tids, cid, onCommandComplete);+ if (!tids.length) {+ return app.alertError('[[error:no-topics-selected]]');}+ move.init(tids, cid, onCommandComplete);return false;});@@ -117,7 +122,7 @@ define('forum/category/tools', [function categoryCommand(command, tids) {if (!tids.length) {- return;+ return app.alertError('[[error:no-topics-selected]]');}translator.translate('[[topic:thread_tools.' + command + '_confirm]]', function (msg) {diff --git a/public/src/client/topic/merge.js b/public/src/client/topic/merge.jsindex caaa01c3ed..473f76583c 100644--- a/public/src/client/topic/merge.js+++ b/public/src/client/topic/merge.js@@ -82,7 +82,7 @@ define('forum/topic/merge', function () {modal.find('.topics-section').html(html);});} else {- modal.find('.topics-section').translateHtml('[[topic:no_topics_selected]]');+ modal.find('.topics-section').translateHtml('[[error:no-topics-selected]]');}}