mirror of
https://github.com/makeplane/plane.git
synced 2025-12-25 08:09:33 +01:00
[WEB-3287]fix: label creation in global views (#6541)
* fix: label creation on enter * fix: update label creation permissions --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
@@ -36,7 +36,8 @@ export const IssueLabelSelect: React.FC<IIssueLabelSelect> = observer((props) =>
|
||||
const [query, setQuery] = useState("");
|
||||
const [submitting, setSubmitting] = useState<boolean>(false);
|
||||
|
||||
const canCreateLabel = allowPermissions([EUserProjectRoles.ADMIN], EUserPermissionsLevel.PROJECT);
|
||||
const canCreateLabel =
|
||||
projectId && allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT, workspaceSlug, projectId);
|
||||
|
||||
const projectLabels = getProjectLabels(projectId);
|
||||
|
||||
@@ -98,7 +99,7 @@ export const IssueLabelSelect: React.FC<IIssueLabelSelect> = observer((props) =>
|
||||
setQuery("");
|
||||
}
|
||||
|
||||
if (query !== "" && e.key === "Enter") {
|
||||
if (query !== "" && e.key === "Enter" && canCreateLabel) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
await handleAddLabel(query);
|
||||
|
||||
@@ -81,7 +81,8 @@ export const LabelDropdown = (props: ILabelDropdownProps) => {
|
||||
const storeLabels = getProjectLabels(projectId);
|
||||
const { allowPermissions } = useUserPermissions();
|
||||
|
||||
const canCreateLabel = allowPermissions([EUserProjectRoles.ADMIN], EUserPermissionsLevel.PROJECT);
|
||||
const canCreateLabel =
|
||||
projectId && allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT, workspaceSlug, projectId);
|
||||
|
||||
let projectLabels: IIssueLabel[] = defaultOptions;
|
||||
if (storeLabels && storeLabels.length > 0) projectLabels = storeLabels;
|
||||
@@ -157,7 +158,7 @@ export const LabelDropdown = (props: ILabelDropdownProps) => {
|
||||
setQuery("");
|
||||
}
|
||||
|
||||
if (query !== "" && e.key === "Enter") {
|
||||
if (query !== "" && e.key === "Enter" && canCreateLabel) {
|
||||
e.preventDefault();
|
||||
await handleAddLabel(query);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user