mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-02 05:40:43 +01:00
fix: improper handling of single vs. multiple inputs for hidePrivateData
This commit is contained in:
@@ -146,8 +146,10 @@ module.exports = function (User) {
|
||||
};
|
||||
|
||||
User.hidePrivateData = async function (users, callerUID) {
|
||||
let single = false;
|
||||
if (!Array.isArray(users)) {
|
||||
users = [users];
|
||||
single = true;
|
||||
}
|
||||
|
||||
const [userSettings, isAdmin, isGlobalModerator] = await Promise.all([
|
||||
@@ -171,7 +173,7 @@ module.exports = function (User) {
|
||||
return _userData;
|
||||
}));
|
||||
|
||||
return users.length === 1 ? users.pop() : users;
|
||||
return single ? users.pop() : users;
|
||||
};
|
||||
|
||||
async function modifyUserData(users, requestedFields, fieldsToRemove) {
|
||||
|
||||
Reference in New Issue
Block a user