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 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>({
@ -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"),
@ -176,7 +181,7 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
onClick={openMenu}
title={_t("Options")}
yOffset={-24}
/>
/> }
<AccessibleTooltipButton
className="mx_RoomSummaryCard_app_pinToggle"