Don't show options button when the user can't modify widgets (#7324)

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-12-10 00:21:05 +01:00 committed by GitHub
parent 8a0398b632
commit 69c847b94c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,6 +96,11 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
const name = WidgetUtils.getWidgetName(app); const name = WidgetUtils.getWidgetName(app);
const dataTitle = WidgetUtils.getWidgetDataTitle(app); const dataTitle = WidgetUtils.getWidgetDataTitle(app);
const subtitle = dataTitle && " - " + dataTitle; const subtitle = dataTitle && " - " + dataTitle;
const [canModifyWidget, setCanModifyWidget] = useState<boolean>();
useEffect(() => {
setCanModifyWidget(WidgetUtils.canUserModifyWidgets(room.roomId));
}, [room.roomId]);
const onOpenWidgetClick = () => { const onOpenWidgetClick = () => {
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({ defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
@ -167,7 +172,7 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
{ subtitle } { subtitle }
</AccessibleTooltipButton> </AccessibleTooltipButton>
<ContextMenuTooltipButton { canModifyWidget && <ContextMenuTooltipButton
className={classNames({ className={classNames({
"mx_RoomSummaryCard_app_options": true, "mx_RoomSummaryCard_app_options": true,
"mx_RoomSummaryCard_maximised_widget": SettingsStore.getValue("feature_maximised_widgets"), "mx_RoomSummaryCard_maximised_widget": SettingsStore.getValue("feature_maximised_widgets"),
@ -176,7 +181,7 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
onClick={openMenu} onClick={openMenu}
title={_t("Options")} title={_t("Options")}
yOffset={-24} yOffset={-24}
/> /> }
<AccessibleTooltipButton <AccessibleTooltipButton
className="mx_RoomSummaryCard_app_pinToggle" className="mx_RoomSummaryCard_app_pinToggle"