Skip to content

Commit

Permalink
[Fix] Cannot set property 'canViewAllInfo' of undefined
Browse files Browse the repository at this point in the history
Fixes RocketChat#22874 

We're getting an error ( Cannot set property 'canViewAllInfo' of undefined ) when calling the /api/v1/users.info endpoint when searching for a user that does not exist.

Cannot set property 'canViewAllInfo' of undefined users.info
  • Loading branch information
Fluffy- authored Aug 5, 2021
1 parent 4b23ca5 commit de9828e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/lib/server/functions/getFullUserData.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export function getFullUserDataByIdOrUsername({ userId, filterId, filterUsername
fields,
};
const user = Users.findOneByIdOrUsername(filterId || filterUsername, options);
user.canViewAllInfo = canViewAllInfo;
if(user){
user.canViewAllInfo = canViewAllInfo;
}

return myself ? user : removePasswordInfo(user);
}
Expand Down

0 comments on commit de9828e

Please sign in to comment.