Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

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

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/views/right_panel/RoomSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
const name = WidgetUtils.getWidgetName(app);
const dataTitle = WidgetUtils.getWidgetDataTitle(app);
const subtitle = dataTitle && " - " + dataTitle;
const [canModifyWidget, setCanModifyWidget] = useState<boolean>();

useEffect(() => {
setCanModifyWidget(WidgetUtils.canUserModifyWidgets(room.roomId));
}, [room.roomId]);

const onOpenWidgetClick = () => {
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
Expand Down Expand Up @@ -167,7 +172,7 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
{ subtitle }
</AccessibleTooltipButton>

<ContextMenuTooltipButton
{ canModifyWidget && <ContextMenuTooltipButton
className={classNames({
"mx_RoomSummaryCard_app_options": true,
"mx_RoomSummaryCard_maximised_widget": SettingsStore.getValue("feature_maximised_widgets"),
Expand All @@ -176,7 +181,7 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
onClick={openMenu}
title={_t("Options")}
yOffset={-24}
/>
/> }

<AccessibleTooltipButton
className="mx_RoomSummaryCard_app_pinToggle"
Expand Down