Skip to content

Node.js based forum software built for the modern web

move addPostData before modifyPostPrivilege

Barış Soner Uşaklı274b33e9e1e0
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);
};