From 652c0373806c1f6691f4338ae73f56fb3749190f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 11 Sep 2020 09:06:17 -0600 Subject: [PATCH] Use hooks better (from develop) --- src/components/views/right_panel/RoomSummaryCard.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/views/right_panel/RoomSummaryCard.tsx b/src/components/views/right_panel/RoomSummaryCard.tsx index e475b0486a..39b255db8e 100644 --- a/src/components/views/right_panel/RoomSummaryCard.tsx +++ b/src/components/views/right_panel/RoomSummaryCard.tsx @@ -40,7 +40,7 @@ import TextWithTooltip from "../elements/TextWithTooltip"; import BaseAvatar from "../avatars/BaseAvatar"; import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import WidgetStore, {IApp} from "../../../stores/WidgetStore"; -import { shieldStatusForRoom } from "../../../utils/ShieldUtils"; +import RoomContext from "../../../contexts/RoomContext"; interface IProps { room: Room; @@ -200,13 +200,8 @@ const RoomSummaryCard: React.FC = ({ room, onClose }) => { }; const isRoomEncrypted = useIsEncrypted(cli, room); - - const [e2eStatus, setE2eStatus] = useState(); - useEffect(() => { - if (isRoomEncrypted) { - shieldStatusForRoom(cli, room).then(e => setE2eStatus(e)); - } - }); + const roomContext = useContext(RoomContext); + const e2eStatus = roomContext['e2eStatus']; const alias = room.getCanonicalAlias() || room.getAltAliases()[0] || ""; const header =