From 274b33e9e1e07ba34d97936860f13566aff5f31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 8 Jun 2018 17:46:49 -0400 Subject: [PATCH] move addPostData before modifyPostPrivilege --- src/socket.io/posts.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 2734e330a9..d0e1372b9e 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -159,13 +159,17 @@ SocketPosts.getReplies = function (socket, pid, callback) { }, function (results, next) { postPrivileges = results.privileges; - results.posts.forEach(function (postData, index) { + + topics.addPostData(results.posts, socket.uid, next); + }, + function (postData, next) { + postData.forEach(function (postData, index) { posts.modifyPostByPrivilege(postData, postPrivileges[index]); }); - results.posts = results.posts.filter(function (postData, index) { + postData = postData.filter(function (postData, index) { return postData && postPrivileges[index].read; }); - topics.addPostData(results.posts, socket.uid, next); + next(null, postData); }, ], callback); };