removed privileges.posts.get from addPostData

privilege data is already available higher up
This commit is contained in:
barisusakli
2015-10-06 18:36:03 -04:00
parent 40e26d3b9d
commit 2d01fe78d0
4 changed files with 28 additions and 20 deletions

View File

@@ -15,12 +15,12 @@ module.exports = function(SocketTopics) {
}
async.parallel({
settings: function(next) {
user.getSettings(socket.uid, next);
},
privileges: function(next) {
privileges.topics.get(data.tid, socket.uid, next);
},
settings: function(next) {
user.getSettings(socket.uid, next);
},
topic: function(next) {
topics.getTopicFields(data.tid, ['postcount', 'deleted'], next);
}
@@ -78,12 +78,15 @@ module.exports = function(SocketTopics) {
'downvote:disabled': function(next) {
next(null, parseInt(meta.config['downvote:disabled'], 10) === 1);
}
}, function(err, results) {
if (results.mainPost) {
results.posts = [results.mainPost].concat(results.posts);
}, function(err, topicData) {
if (err) {
return callback(err);
}
callback(err, results);
if (topicData.mainPost) {
topicData.posts = [topicData.mainPost].concat(topicData.posts);
}
topics.modifyByPrivilege(topicData.posts, results.privileges);
callback(null, topicData);
});
});
};