Skip to content

Add ability to remove a work item's parent with GraphQL

Eugenia Grieff requested to merge 362213-remove-work-item-parent into master

What does this MR do and why?

This is the third task needed for #362213 (closed).

Depends on the previous task being completed: GraphQL: Add hierarchyWidget to work item updat... (!90908 - merged)

Adds the option to pass null to parentId argument in WorkItemUpdate mutation. This action will remove the parent of a given work item. This is done through the input hierarchyWidget.

How to set up and validate locally

  1. Enable :work_items and work_items_hierarchy feature flags

    Feature.enable(:work_items)
    Feature.enable(:work_items_hierarchy)
  2. Run GraphQL query with http://local-url/-/graphql-explorer

removeParent
mutation removeParent {
  workItemUpdate(input: { id: "gid://gitlab/Issue/{ISSUE_ID}" , hierarchyWidget: { parentId: null }}) {
    workItem {
      id
      widgets {
        ... on WorkItemWidgetHierarchy {
          parent {
            id
          }
        }
      }
    }
    errors
  }
}
  1. The response should return null for parent:
example response
{
  "data": {
    "workItemUpdate": {
      "workItem": {
        "id": "gid://gitlab/WorkItem/1688",
        "widgets": [
          {},
          {},
          {
            "parent": null
          },
          {}
        ]
      },
      "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.

Related to #362213 (closed)

Edited by Eugenia Grieff

Merge request reports

Loading