Node.js based forum software built for the modern web
modules.js error keys
barisusaklib07efb0085fc
diff --git a/public/language/en_GB/error.json b/public/language/en_GB/error.jsonindex 25cfd06ea4..1d8c1fbb4c 100644--- a/public/language/en_GB/error.json+++ b/public/language/en_GB/error.json@@ -5,6 +5,7 @@"invalid-cid": "Invalid Category ID","invalid-tid": "Invalid Topic ID",+ "invalid-pid": "Invalid Post ID","no-category": "Category doesn't exist","no-topic": "Topic doesn't exist",diff --git a/src/socket.io/modules.js b/src/socket.io/modules.jsindex 115bcf17b8..7dea871b32 100644--- a/src/socket.io/modules.js+++ b/src/socket.io/modules.js@@ -49,35 +49,36 @@ var stopTracking = function(replyObj) {};SocketModules.composer.push = function(socket, pid, callback) {- if (socket.uid || parseInt(meta.config.allowGuestPosting, 10)) {- if (parseInt(pid, 10) > 0) {-- async.parallel([- function(next) {- posts.getPostFields(pid, ['content'], next);- },- function(next) {- topics.getTopicDataByPid(pid, next);- },- function(next) {- posts.getPidIndex(pid, next);- }- ], function(err, results) {- if(err) {- return callback(err);- }- callback(null, {- pid: pid,- body: results[0].content,- title: results[1].title,- topic_thumb: results[1].thumb,- index: results[2]- });- });- }- } else {- callback(new Error('no-uid'));+ if(!socket.uid && parseInt(meta.config.allowGuestPosting, 10) !== 1) {+ return callback(new Error('[[error:not-logged-in]]'));}++ posts.getPostFields(pid, ['content'], function(err, postData) {+ if(err || (!postData && !postData.content)) {+ return callback(err || new Error('[[error:invalid-pid]]'));+ }++ async.parallel({+ topic: function(next) {+ topics.getTopicDataByPid(pid, next);+ },+ index: function(next) {+ posts.getPidIndex(pid, next);+ }+ }, function(err, results) {+ if(err) {+ return callback(err);+ }++ callback(null, {+ pid: pid,+ body: postData.content,+ title: results.topic.title,+ topic_thumb: results.topic.thumb,+ index: results.index+ });+ });+ });};SocketModules.composer.editCheck = function(socket, pid, callback) {@@ -150,7 +151,7 @@ SocketModules.composer.getUsersByTid = function(socket, tid, callback) {SocketModules.chats.get = function(socket, data, callback) {if(!data) {- return callback(new Error('invalid data'));+ return callback(new Error('[[error:invalid-data]]'));}Messaging.getMessages(socket.uid, data.touid, false, callback);@@ -158,7 +159,7 @@ SocketModules.chats.get = function(socket, data, callback) {SocketModules.chats.send = function(socket, data, callback) {if(!data) {- return callback(new Error('invalid data'));+ return callback(new Error('[[error:invalid-data]]'));}var touid = data.touid;