mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 23:40:38 +01:00
filter posts that you cant read
This commit is contained in:
@@ -127,9 +127,6 @@ SocketPosts.getReplies = function (socket, pid, callback) {
|
|||||||
function (next) {
|
function (next) {
|
||||||
posts.getPidsFromSet('pid:' + pid + ':replies', 0, -1, false, next);
|
posts.getPidsFromSet('pid:' + pid + ':replies', 0, -1, false, next);
|
||||||
},
|
},
|
||||||
function (pids, next) {
|
|
||||||
privileges.posts.filter('read', pids, socket.uid, next);
|
|
||||||
},
|
|
||||||
function (pids, next) {
|
function (pids, next) {
|
||||||
async.parallel({
|
async.parallel({
|
||||||
posts: function (next) {
|
posts: function (next) {
|
||||||
@@ -142,6 +139,9 @@ SocketPosts.getReplies = function (socket, pid, callback) {
|
|||||||
},
|
},
|
||||||
function (results, next) {
|
function (results, next) {
|
||||||
postPrivileges = results.privileges;
|
postPrivileges = results.privileges;
|
||||||
|
results.posts = results.posts.filter(function (postData, index) {
|
||||||
|
return postData && postPrivileges[index].read;
|
||||||
|
});
|
||||||
topics.addPostData(results.posts, socket.uid, next);
|
topics.addPostData(results.posts, socket.uid, next);
|
||||||
},
|
},
|
||||||
function (postData, next) {
|
function (postData, next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user