From 115598f3828f220d4302701df61a922fa2f73d06 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 2 Aug 2014 16:41:44 -0400 Subject: [PATCH] minor refactor --- src/socket.io/posts.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index a5344d0f2a..9f6156c89f 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -144,18 +144,14 @@ SocketPosts.getRawPost = function(socket, pid, callback) { return next(new Error('[[error:no-privileges]]')); } posts.getPostFields(pid, ['content', 'deleted'], next); + }, + function(postData, next) { + if (parseInt(postData.deleted, 10) === 1) { + return next(new Error('[[error:no-post]]')); + } + next(null, postData.content); } - ], function(err, post) { - if(err) { - return callback(err); - } - - if(parseInt(post.deleted, 10) === 1) { - return callback(new Error('[[error:no-post]]')); - } - - callback(null, post.content); - }); + ], callback); }; SocketPosts.edit = function(socket, data, callback) {