Skip to content

GraphQL: Add descriptionWidget to work item update mutation

Eugenia Grieff requested to merge 362213-description-widget--service into master

What does this MR do and why?

Related to #362213 (closed)

  • Adds argument descriptionWidget to WorkItemUpdate 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

  1. Enable :work_items FF

    Feature.enable(:work_items)
  2. 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
      }
    }
  3. 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.

Edited by Eugenia Grieff

Merge request reports

Loading