move addPostData before modifyPostPrivilege

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

@ -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);
};

Loading…
Cancel
Save