modules.js error keys

v1.18.x
barisusakli 11 years ago
parent 7b992e7a20
commit b07efb0085

@ -5,6 +5,7 @@
"invalid-cid": "Invalid Category ID", "invalid-cid": "Invalid Category ID",
"invalid-tid": "Invalid Topic ID", "invalid-tid": "Invalid Topic ID",
"invalid-pid": "Invalid Post ID",
"no-category": "Category doesn't exist", "no-category": "Category doesn't exist",
"no-topic": "Topic doesn't exist", "no-topic": "Topic doesn't exist",

@ -49,35 +49,36 @@ var stopTracking = function(replyObj) {
}; };
SocketModules.composer.push = function(socket, pid, callback) { SocketModules.composer.push = function(socket, pid, callback) {
if (socket.uid || parseInt(meta.config.allowGuestPosting, 10)) { if(!socket.uid && parseInt(meta.config.allowGuestPosting, 10) !== 1) {
if (parseInt(pid, 10) > 0) { return callback(new Error('[[error:not-logged-in]]'));
}
async.parallel([ posts.getPostFields(pid, ['content'], function(err, postData) {
function(next) { if(err || (!postData && !postData.content)) {
posts.getPostFields(pid, ['content'], next); return callback(err || new Error('[[error:invalid-pid]]'));
}, }
function(next) {
async.parallel({
topic: function(next) {
topics.getTopicDataByPid(pid, next); topics.getTopicDataByPid(pid, next);
}, },
function(next) { index: function(next) {
posts.getPidIndex(pid, next); posts.getPidIndex(pid, next);
} }
], function(err, results) { }, function(err, results) {
if(err) { if(err) {
return callback(err); return callback(err);
} }
callback(null, { callback(null, {
pid: pid, pid: pid,
body: results[0].content, body: postData.content,
title: results[1].title, title: results.topic.title,
topic_thumb: results[1].thumb, topic_thumb: results.topic.thumb,
index: results[2] index: results.index
});
}); });
}); });
}
} else {
callback(new Error('no-uid'));
}
}; };
SocketModules.composer.editCheck = function(socket, pid, callback) { 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) { SocketModules.chats.get = function(socket, data, callback) {
if(!data) { if(!data) {
return callback(new Error('invalid data')); return callback(new Error('[[error:invalid-data]]'));
} }
Messaging.getMessages(socket.uid, data.touid, false, callback); 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) { SocketModules.chats.send = function(socket, data, callback) {
if(!data) { if(!data) {
return callback(new Error('invalid data')); return callback(new Error('[[error:invalid-data]]'));
} }
var touid = data.touid; var touid = data.touid;

Loading…
Cancel
Save