mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
privileges.posts.get takes an array of pids now
This commit is contained in:
@@ -226,12 +226,16 @@ SocketPosts.purge = function(socket, data, callback) {
|
||||
};
|
||||
|
||||
SocketPosts.getPrivileges = function(socket, pid, callback) {
|
||||
privileges.posts.get(pid, socket.uid, function(err, privileges) {
|
||||
if(err) {
|
||||
privileges.posts.get([pid], socket.uid, function(err, privileges) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
privileges.pid = parseInt(pid, 10);
|
||||
callback(null, privileges);
|
||||
if (!Array.isArray(privileges) || !privileges.length) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
privileges[0].pid = parseInt(pid, 10);
|
||||
callback(null, privileges[0]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user