Client: Groups: Fix deleting current group from info panel

This commit is contained in:
Aleksandr Lushkin 2024-08-01 17:27:00 +02:00
parent 915fbac03e
commit c2bbfce902
2 changed files with 13 additions and 2 deletions

View File

@ -27,6 +27,7 @@
import { useRef } from "react";
import { withTranslation } from "react-i18next";
import { useTheme } from "styled-components";
import { matchPath } from "react-router";
import { Text } from "@docspace/shared/components/text";
import { ContextMenuButton } from "@docspace/shared/components/context-menu-button";
import { Avatar, AvatarSize } from "@docspace/shared/components/avatar";
@ -46,8 +47,13 @@ const GroupsItemTitle = ({
const itemTitleRef = useRef();
const theme = useTheme();
const isInsideGroup = matchPath(
"/accounts/groups/:groupId/filter",
location.pathname,
);
const getContextOptions = () =>
getGroupContextOptions(t, infoPanelSelection, true);
getGroupContextOptions(t, infoPanelSelection, true, isInsideGroup);
const groupName = infoPanelSelection.name
? decode(infoPanelSelection.name).trim()

View File

@ -582,7 +582,12 @@ class GroupsStore {
label: t("Common:Delete"),
title: t("Common:Delete"),
icon: TrashReactSvgUrl,
onClick: () => this.onDeleteClick(item.name),
onClick: () => {
if (forInsideGroup) {
this.setBufferSelection(item);
}
this.onDeleteClick(item.name);
},
},
];
};