From b7ace4ca3879946c6e5da9d23b307d65f4b8b907 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Tue, 14 May 2024 16:57:24 -0300 Subject: [PATCH] Hide call button from RoomInfo if has e2ee warning --- .../RoomInfoView/components/RoomInfoButtons.tsx | 4 +++- app/views/RoomInfoView/hooks.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 app/views/RoomInfoView/hooks.ts diff --git a/app/views/RoomInfoView/components/RoomInfoButtons.tsx b/app/views/RoomInfoView/components/RoomInfoButtons.tsx index 2f5009cef..657c29c69 100644 --- a/app/views/RoomInfoView/components/RoomInfoButtons.tsx +++ b/app/views/RoomInfoView/components/RoomInfoButtons.tsx @@ -9,6 +9,7 @@ import { useVideoConf } from '../../../lib/hooks/useVideoConf'; import { useTheme } from '../../../theme'; import styles from '../styles'; import { compareServerVersion } from '../../../lib/methods/helpers'; +import { useE2EEWarning } from '../hooks'; function BaseButton({ danger, @@ -89,6 +90,7 @@ export const RoomInfoButtons = ({ const isDirectFromSaved = isDirect && fromRid && room; const isIgnored = room?.ignored?.includes?.(roomUserId || ''); const isBlocked = room?.blocker; + const hasE2EEWarning = useE2EEWarning(room); const renderIgnoreUser = isDirectFromSaved && !isFromDm && !isDmWithMyself; const renderBlockUser = !itsMe && isDirectFromSaved && isFromDm && !isDmWithMyself; @@ -98,7 +100,7 @@ export const RoomInfoButtons = ({ return ( - + {hasE2EEWarning ? null : } { + const encryptionEnabled = useAppSelector(state => state.encryption.enabled); + if (!room) { + return false; + } + return hasE2EEWarning({ + encryptionEnabled, + E2EKey: room.E2EKey, + roomEncrypted: room.encrypted + }); +};