mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: add vote status to getPostData API call
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user