[FIX] Cannot read property 'some' of undefined on hasPermission (#2966)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Gung Wah 2021-03-05 21:44:46 +08:00 committed by GitHub
parent e35f7fe583
commit 40c075d748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1192,7 +1192,7 @@ const RocketChat = {
// get user roles on the server from redux
const userRoles = (shareUser?.roles || loginUser?.roles) || [];
const mergedRoles = [...new Set([...roomRoles, ...userRoles])];
return permissions.map(permission => permission.some(r => mergedRoles.includes(r) ?? false));
return permissions.map(permission => permission?.some(r => mergedRoles.includes(r) ?? false));
} catch (e) {
log(e);
}