From c1d28af2a7ad31ff461fb33a5c06833cc07e06a8 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 10 Nov 2016 13:37:34 +0300 Subject: [PATCH] filter posts that you cant read --- src/socket.io/posts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 30dfa016ee..7cc43178d6 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -127,9 +127,6 @@ SocketPosts.getReplies = function (socket, pid, callback) { function (next) { posts.getPidsFromSet('pid:' + pid + ':replies', 0, -1, false, next); }, - function (pids, next) { - privileges.posts.filter('read', pids, socket.uid, next); - }, function (pids, next) { async.parallel({ posts: function (next) { @@ -142,6 +139,9 @@ SocketPosts.getReplies = function (socket, pid, callback) { }, function (results, next) { postPrivileges = results.privileges; + results.posts = results.posts.filter(function (postData, index) { + return postData && postPrivileges[index].read; + }); topics.addPostData(results.posts, socket.uid, next); }, function (postData, next) {