WorkItemConvert mutation
What does this MR do and why?
Part of #386876 (closed) and &9438 (comment 1281758135).
This MR introduces a mutation to change the work item type. It's using a separate mutation, instead of the existing update mutation, prevent cases where a new type gets set + new data for a widget that doesn't exist in the new type. As the mutation is in alpha, we could still remove it in the future if we see that there are issues with this approach.
The approach we take is that we allow to convert any work item type to any other and
- Validate if the hierarchy restrictions allow it (this is done in !113852 (merged))
- Remove the widget data that is no longer available in the new type
It's branched off from !113852 (merged) where I worked on the work item type validation on the Model layer to make this MR smaller.
Screenshots or screen recordings
How to set up and validate locally
Feature.enable(:work_item_conversion)
- Create a work item (e.g. OKR, Key Result, or Task)
- Fill in the data and change the types
- You can get the work item type IDs by quering:
WorkItems::Type.all
query workItem {
workItem(id: "gid://gitlab/WorkItem/713") {
id
workItemType {
id
name
}
}
}
mutation convertWorkItem {
workItemConvert(input:{id: "gid://gitlab/WorkItem/713", workItemTypeId:"gid://gitlab/WorkItems::Type/3186"}) {
clientMutationId
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.