From 57ebcb8b8ab3c9907be205d7297ac45998c21820 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 4 Feb 2015 18:16:10 -0500 Subject: [PATCH] closes #2694 --- src/socket.io/posts.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 5baa38e9cb..5ac3cfb759 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -396,9 +396,6 @@ SocketPosts.flag = function(socket, pid, callback) { post; async.waterfall([ - function(next) { - posts.flag(pid, next); - }, function(next) { user.getUserFields(socket.uid, ['username', 'reputation'], next); }, @@ -407,7 +404,6 @@ SocketPosts.flag = function(socket, pid, callback) { return next(new Error('[[error:not-enough-reputation-to-flag]]')); } userName = userData.username; - posts.getPostFields(pid, ['tid', 'uid', 'content', 'deleted'], next); }, function(postData, next) { @@ -415,7 +411,10 @@ SocketPosts.flag = function(socket, pid, callback) { return next(new Error('[[error:post-deleted]]')); } post = postData; - topics.getTopicFields(postData.tid, ['title', 'cid'], next); + posts.flag(pid, next); + }, + function(next) { + topics.getTopicFields(post.tid, ['title', 'cid'], next); }, function(topic, next) { post.topic = topic;