move modifyPostByPrivilege call before filtering posts so index is correct

v1.18.x
Barış Soner Uşaklı 7 years ago
parent 8d41e319ea
commit acf2f2a776

@ -159,17 +159,14 @@ SocketPosts.getReplies = function (socket, pid, callback) {
},
function (results, next) {
postPrivileges = results.privileges;
results.posts.forEach(function (postData, index) {
posts.modifyPostByPrivilege(postData, postPrivileges[index]);
});
results.posts = results.posts.filter(function (postData, index) {
return postData && postPrivileges[index].read;
});
topics.addPostData(results.posts, socket.uid, next);
},
function (postData, next) {
postData.forEach(function (postData, index) {
posts.modifyPostByPrivilege(postData, postPrivileges[index]);
});
next(null, postData);
},
], callback);
};

Loading…
Cancel
Save