From 40c075d748baa94456372dbf1154d41484ba294a Mon Sep 17 00:00:00 2001 From: Gung Wah <41157464+kresnaputra@users.noreply.github.com> Date: Fri, 5 Mar 2021 21:44:46 +0800 Subject: [PATCH] [FIX] Cannot read property 'some' of undefined on hasPermission (#2966) Co-authored-by: Diego Mello --- app/lib/rocketchat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 4d1b2fbb5..53c792100 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -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); }