From 69c847b94c7f0d5a92e0551e6c98b9aded36848b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 10 Dec 2021 00:21:05 +0100 Subject: [PATCH] Don't show options button when the user can't modify widgets (#7324) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/right_panel/RoomSummaryCard.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/RoomSummaryCard.tsx b/src/components/views/right_panel/RoomSummaryCard.tsx index 6aaddccdd9..0988960bee 100644 --- a/src/components/views/right_panel/RoomSummaryCard.tsx +++ b/src/components/views/right_panel/RoomSummaryCard.tsx @@ -96,6 +96,11 @@ const AppRow: React.FC = ({ app, room }) => { const name = WidgetUtils.getWidgetName(app); const dataTitle = WidgetUtils.getWidgetDataTitle(app); const subtitle = dataTitle && " - " + dataTitle; + const [canModifyWidget, setCanModifyWidget] = useState(); + + useEffect(() => { + setCanModifyWidget(WidgetUtils.canUserModifyWidgets(room.roomId)); + }, [room.roomId]); const onOpenWidgetClick = () => { defaultDispatcher.dispatch({ @@ -167,7 +172,7 @@ const AppRow: React.FC = ({ app, room }) => { { subtitle } - = ({ app, room }) => { onClick={openMenu} title={_t("Options")} yOffset={-24} - /> + /> }