Skip to content

Commit

Permalink
fix: label creation on enter
Browse files Browse the repository at this point in the history
  • Loading branch information
vamsikrishnamathala committed Feb 3, 2025
1 parent c14fb81 commit 04c0569
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const LabelDropdown = (props: ILabelDropdownProps) => {
const storeLabels = getProjectLabels(projectId);
const { allowPermissions } = useUserPermissions();

const canCreateLabel = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT);
const canCreateLabel = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT, workspaceSlug);

let projectLabels: IIssueLabel[] = defaultOptions;
if (storeLabels && storeLabels.length > 0) projectLabels = storeLabels;
Expand Down Expand Up @@ -157,7 +157,7 @@ export const LabelDropdown = (props: ILabelDropdownProps) => {
setQuery("");
}

if (query !== "" && e.key === "Enter") {
if (query !== "" && e.key === "Enter" && canCreateLabel) {
e.preventDefault();
await handleAddLabel(query);
}
Expand Down

0 comments on commit 04c0569

Please sign in to comment.