Skip to content

Add notes widget resolver

Alexandru Croitor requested to merge notes_widget into master

What does this MR do and why?

This MR implements fetchign work item notes through widgets interface. This allows fetching all notes, user comments only or system notes only.

re #378949 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Sample qraphql query to without a specified limit, which gets 100 discussions:

{
  queryComplexity {
    score
    limit
  }
  project(fullPath: "mass_insert_group__0_1/mass_insert_group__1_1/mass_insert_group__2_2/mass_insert_group__3_2/mass_insert_group__4_1/mass_insert_project_private_1") {
    workItems(iid: "454") {
       nodes {
    		id
        title
        widgets {

          ... on WorkItemWidgetNotes {
            discussions {
              nodes {
                id
                
                notes {
                  nodes {                    
                    id
                    createdAt
                    internal
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

response:

{
  "data": {
    "queryComplexity": {
      "score": 125,
      "limit": 300
    },
    "project": {
      "workItems": {
        "nodes": [
          {
            "id": "gid://gitlab/WorkItem/81435",
            "title": "Omnis quos beatae voluptatem quaerat sunt officia repellat odit.",
            "widgets": [
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {
                "discussions": {
                  "nodes": [
                    {
                      "id": "gid://gitlab/IndividualNoteDiscussion/271509ab3e3943b4d68f1f1f49c7a8fff938d53f",
                      "notes": {
                        "nodes": [
                          {
                            "id": "gid://gitlab/Note/37077",
                            "createdAt": "2022-10-31T11:33:20Z",
                            "internal": false
                          }
                        ]
                      }
                    },
                    .......
                   ]
                }
              }
          }
      }
    }
  }
}

Sample qraphql query to that specifies first: 3 discussions:

{
  queryComplexity {
    score
    limit
  }
  project(fullPath: "mass_insert_group__0_1/mass_insert_group__1_1/mass_insert_group__2_2/mass_insert_group__3_2/mass_insert_group__4_1/mass_insert_project_private_1") {
    workItems(iid: "454") {
       nodes {
    		id
        title
        widgets {

          ... on WorkItemWidgetNotes {
            discussions(first: 3) {
              nodes {
                id
                
                notes {
                  nodes {                    
                    id
                    createdAt
                    internal
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

response:

{
  "data": {
    "queryComplexity": {
      "score": 28,
      "limit": 300
    },
    "project": {
      "workItems": {
        "nodes": [
          {
            "id": "gid://gitlab/WorkItem/81435",
            "title": "Omnis quos beatae voluptatem quaerat sunt officia repellat odit.",
            "widgets": [
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {},
              {
                "discussions": {
                  "nodes": [
                    {
                      "id": "gid://gitlab/IndividualNoteDiscussion/271509ab3e3943b4d68f1f1f49c7a8fff938d53f",
                      "notes": {
                        "nodes": [
                          {
                            "id": "gid://gitlab/Note/37077",
                            "createdAt": "2022-10-31T11:33:20Z",
                            "internal": false
                          }
                        ]
                      }
                    },
                    .......
                   ]
                }
              }
          }
      }
    }
  }
}

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 Alexandru Croitor

Merge request reports