feat: add vote status to getPostData API call

This commit is contained in:
Julian Lam
2019-02-19 11:41:16 -05:00
parent fab32a4963
commit eafe76debb

View File

@@ -133,14 +133,16 @@ apiController.getPostData = function (pid, uid, callback) {
post: function (next) {
posts.getPostData(pid, next);
},
voted: async.apply(posts.hasVoted, pid, uid),
}, function (err, results) {
if (err || !results.post) {
return callback(err);
}
var post = results.post;
var privileges = results.privileges[0];
Object.assign(post, results.voted);
var privileges = results.privileges[0];
if (!privileges.read || !privileges['topics:read']) {
return callback();
}