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:
parent
8a0398b632
commit
69c847b94c
1 changed files with 7 additions and 2 deletions
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue