feat: add vote status to getPostData API call

v1.18.x
Julian Lam 6 years ago
parent fab32a4963
commit eafe76debb

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

Loading…
Cancel
Save