show deleted replies like regular deleted posts

This commit is contained in:
barisusakli
2016-11-02 13:21:51 +03:00
parent 66aea0eed1
commit 96d05b58d4
4 changed files with 31 additions and 17 deletions

View File

@@ -122,23 +122,32 @@ SocketPosts.getReplies = function (socket, pid, callback) {
if (!utils.isNumber(pid)) {
return callback(new Error('[[error:invalid-data]'));
}
var postPrivileges;
async.waterfall([
function (next) {
posts.getPidsFromSet('pid:' + pid + ':replies', 0, -1, false, next);
},
function (pids, next) {
privileges.posts.filter('read', pids, socket.uid, next);
async.parallel({
posts: function (next) {
posts.getPostsByPids(pids, socket.uid, next);
},
privileges: function (next) {
privileges.posts.get(pids, socket.uid, next);
}
}, next);
},
function (pids, next) {
posts.getPostsByPids(pids, socket.uid, next);
function (results, next) {
postPrivileges = results.privileges;
topics.addPostData(results.posts, socket.uid, next);
},
function (postData, next) {
postData.forEach(function (postData) {
posts.modifyPostByPrivilege(postData, postPrivileges.isAdminOrMod);
});
next(null, postData);
}
], function (err, postData) {
if (err) {
return callback(err);
}
topics.addPostData(postData, socket.uid, callback);
});
], callback);
};