GraphQL: Add descriptionWidget to work item update mutation
What does this MR do and why?
Related to #362213 (closed)
- Adds argument
descriptionWidget
toWorkItemUpdate
mutation so we are able to update the widget at the same time as updating other work item attributes
In !88955 (merged) we added support for the description widget in WorkItemUpdateWidgets
. This mutation will be deprecated if not needed. See #332566 (comment 995479457) for more context.
- In preparation for allowing to update other widgets in the same mutation, it was decided to move the widget update logic from the model layer to a service layer so we can support increasing complexity.
Further widgets will be added after these changes (i.e: !89407 (closed) for the hierarchy widget) so we need to support new arguments being generated from WorkItems::Type.available_widgets
.
How to set up and validate locally
-
Enable
:work_items
FFFeature.enable(:work_items)
-
Run GraphQL query with
http://local-url/-/graphql-explorer
mutation updateWorkItem { workItemUpdate(input: {id: "gid://gitlab/Issue/{ISSUE_ID}", descriptionWidget: {description: "updated description"}}) { workItem { widgets { ... on WorkItemWidgetDescription { description descriptionHtml } } } errors } }
-
It should return a response with updated description and no errors
example response
{
"data": {
"workItemUpdate": {
"workItem": {
"widgets": [
{
"description": "updated description",
"descriptionHtml": "<p data-sourcepos=\"1:1-1:19\" dir=\"auto\">updated description</p>"
},
{}
]
},
"errors": []
}
}
}
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.
Edited by Eugenia Grieff