[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:
parent
8efe692c80
commit
dff12729c0
2 changed files with 6 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue