Skip to content

Commit

Permalink
[FIX] Unwanted toastr error message when deleting user (#23372)
Browse files Browse the repository at this point in the history
* check if user exists when accessing canViewAllInfo

* Explicitly return null

Co-authored-by: Tasso Evangelista <tasso.evangelista@rocket.chat>
  • Loading branch information
2 people authored and sampaiodiego committed Oct 6, 2021
1 parent ca20f8f commit af2dd60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/lib/server/functions/getFullUserData.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export function getFullUserDataByIdOrUsername({ userId, filterId, filterUsername
fields,
};
const user = Users.findOneByIdOrUsername(filterId || filterUsername, options);
if (!user) {
return null;
}

user.canViewAllInfo = canViewAllInfo;

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

0 comments on commit af2dd60

Please sign in to comment.