Allow creating project-level work items epics
What does this MR do and why?
Related to #516896 (closed)
This MR introduces the missing permissions that allow us to create project-level work items with the type Epic
.
Creating and listing this type of work item will be guarded by the feature flag project_work_item_epics
, and in the same way as group-level epics, it requires the epics
licensed feature.
These changes only affect the graphQL API endpoints, we don't have access to creating this type via the UI yet.
To note: Given that we can use the ProjectType.issues
or ProjectType.work_items
endpoints for listing work items, we have to prevent read_issue
and read_work_item
abilities when the item has type Epic
and license is not available (or FF is disabled).
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
example queries
Feature Flag enabled
create project-level epic | list project-level epics |
---|---|
![]() |
![]() |
Feature Flag disabled
create project-level epic | list project-level epics |
---|---|
![]() |
![]() |
How to set up and validate locally
- In rails console enable feature flag
Feature.enable(:project_work_item_epics)
- Visit GraphQL explorer
http://gdk.test:3000/-/graphql-explorer
and very that the following queries create and fetch a project-level work item with typeEpic
:
graphQL queries
mutation createEpicWorkItem {
workItemCreate(input: {
namespacePath: "GROUP_PATH/PROJECT_PATH", title: "Project Epic",
workItemTypeId: "gid://gitlab/WorkItems::Type/8"
}) {
workItem {
title
webUrl
workItemType {
name
}
}
errors
}
}
query getProjectWorkItems {
project(fullPath: "GROUP_PATH/PROJECT_PATH") {
workItems(types: [EPIC]) {
edges {
node {
title
webUrl
workItemType { name }
}
}
}
}
}
# Because work items are an issue record, they can be fetched using the Issues query too
query getProjectIssues {
project(fullPath: "GROUP_PATH/PROJECT_PATH") {
issues(types: [EPIC]) {
edges {
node {
title
}
}
}
}
}
- Disable the feature flag and verify that the mutation returns an error and the queries are empty