Allow excluding group-level work items in group.workItems GQL field
What does this MR do and why?
Adds exclude_group_work_items parameter to WorkItems::WorkItemsFinder to match IssuesFinder behaviour, which will enable migrating the group-level issues list to use the work items API.
ETA: The parameter was included in a separate MR (!202865 (merged)), this one was updated to add the GQL argument and tests.
Changes:
Addexclude_group_work_itemsparam toWorkItems::WorkItemsFinder(defaults false). When true, filters out group-level work items, returning only project work items- Add argument
excludeGroupWorkItemsto the GraphQL fieldsnamespace.workItemsandgroup.workItems
Database
- No new DB queries - reuses existing exclusion logic
- Same query plan as the current
IssuesFindergroup behaviour
WorkItems::WorkItemsFinder.new(current_user, { group_id: group.id, include_descendants: true, exclude_projects: false, exclude_group_work_items: true }).execute
exclude_group_work_items value |
query plan |
|---|---|
false |
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/42808/commands/131076 |
true |
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/42808/commands/131066 |
References
Related to #565433 (closed)
Screenshots or screen recordings
How to set up and validate locally
- Create a group and a subgroup. Add a project in each level
- Create a work item in each (requires enabling the flag
create_group_level_work_itemsfor the group-level work item)
createWorkItem
mutation createWorkItem {
workItemCreate(input: {
namespacePath: {group_path|project_path}, title: "Issue in {group_path|project_path}",
workItemTypeId: "gid://gitlab/WorkItems::Type/1"
}) {
workItem {
id
workItemType { name }
}
errors
}
}
- Use the following query with the different argument combinations to verify that group-level work items are excluded
getWorkItems
query getWorkItems($excludeProjects: Boolean, $includeDescendants: Boolean, $excludeGroupWorkItems: Boolean, $fullPath: ID!) {
group(fullPath: $fullPath) {
workItems(
excludeProjects: $excludeProjects
includeDescendants: $includeDescendants
excludeGroupWorkItems: $excludeGroupWorkItems
) {
nodes {
title
}
}
}
}
{
"excludeProjects": false,
"includeDescendants": true,
"excludeGroupWorkItems": true,
"fullPath": "root-group"
}
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Eugenia Grieff

