Skip to content

Fix updating group level work item labels

Mario Celi requested to merge 426472-update-labels-group-level into master

What does this MR do and why?

Now work items can belong directly to a group. We need to make just a few changes for updating labels to work in this scenario

How to set up and validate locally

  1. Enable the feature flag in Rails console Feature.enable(:namespace_level_work_items)
  2. Create a group level work item with the following query at http://127.0.0.1:3000/-/graphql-explorer so you can use it in the next query
    mutation {
       workItemCreate(input: {namespacePath: "flightjs", title: "test group level work item", workItemTypeId: "gid://gitlab/WorkItems::Type/1"}) {
         errors
         workItem {
           id
           iid
         }
       }
     }
  3. Update labels on the newly created work item
     mutation {
       workItemUpdate(input:{id: "<id_returned_in_previous_step>", labelsWidget: {addLabelIds: ["gid://gitlab/GroupLabel/52", "gid://gitlab/GroupLabel/50"]}}) {
         errors
         workItem {
           id
           iid
           widgets {
             ... on WorkItemWidgetLabels {
               allowsScopedLabels
               labels {
                 nodes {
                   color
                   id
                   title
                 }
               }
             }
           }
         }
       }
     }
    Before this change, you will get and undefined method for nil error. Now in the response you should see the specified labels associated with the work item

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 #426472 (closed)

Edited by Mario Celi

Merge request reports