Skip to content

Fix fetching notes widget for group work items

Mario Celi requested to merge 426473-read-group-work-item-notes into master

What does this MR do and why?

Small policy change required to allow fetching notes created on a group level work item

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. create a note on the newly created work item
     mutation {
       createNote(input:{noteableId: "<id_from_the_previous_step>", body: "testing note"}) {
         errors
         note {
           body
           authorIsContributor
           project {
             id
           }
         }
       }
     }
  4. fetch notes for the newly created work item
    {
       workItem(id: "<id_from_the_first_step>") {
         id
         title
         archived
         project {
           id
         }
         widgets {
           ... on WorkItemWidgetNotes {
             discussions {
               nodes {
                 notes {
                   nodes {
                     body
                   }
                 }
               }
             }
           }
         }
       }
     }

This should return the note you created on step 2. Before this change, the last query would always return an empty array of discussions

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

Edited by Mario Celi

Merge request reports