Skip to content

Fix weight widget for group level work items

Mario Celi requested to merge 429598-fix-setting-weight into master

What does this MR do and why?

issue_weights feature availability was checked only against an issues's project. We should check against a group when the issue is directly associated with one

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 the weight on the newly created work item
    mutation {
       workItemUpdate(input: {id: "<gid_from_previous_step>", weightWidget: {weight: 3}}) {
         errors
         workItem {
           workItemType {
             name
           }
           widgets {
             ... on WorkItemWidgetWeight {
               weight
             }
           }
         }
       }
     }

In the response before this change you will get no weight widget, nor you will see that the value has been updated in the DB using the rails console.

This feature is still behind a feature flag so no changelog required

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

Edited by Mario Celi

Merge request reports