Skip to content

Deprecate confidential attribute for notes

Nicolas Dular requested to merge nd/deprecate-confidential-field into master

What does this MR do and why?

Issue: #367922 (closed)

This deprecates the confidential parameter for the Notes API in favour of internal. This affects the GraphQL API, REST API, and internal Notes creation API.

We also expose the internal attribute now for a Note and the behaviour of internal and confidential is the same.

In the case of submitting a request to create a note with internal: true, and confidential: false, internal overrules the confidential parameter.

In a follow-up work, the remaining mentions of confidential in the Services, Models, and Database column will be renamed.

How to set up and validate locally

UI

The UI is still using confidential parameter. To validate it still works:

Screenshot_2022-08-10_at_17.38.15

  1. For Issues: Go to an issue and create a new note, while selecting Make this an internal note
  2. For Epics: Go to an epic and create a new note, while selecting Make this an internal note

API

REST

Get (internal) Note(s)
curl --header "PRIVATE-TOKEN: PAT" "http://localhost:3000/api/v4/projects/PROJECT_ID/issues/ISSUE_ID/notes/"

[
   {
      "attachment" : null,
      "author" : {
         "avatar_url" : "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
         "id" : 1,
         "name" : "Administrator",
         "state" : "active",
         "username" : "root",
         "web_url" : "http://127.0.0.1:3000/root"
      },
      "body" : "foobar",
      "commands_changes" : {},
      "confidential" : true,
      "created_at" : "2022-08-10T14:46:01.597Z",
      "id" : 1141,
      "internal" : true,
      "noteable_id" : 436,
      "noteable_iid" : 24,
      "noteable_type" : "Issue",
      "resolvable" : false,
      "system" : false,
      "type" : null,
      "updated_at" : "2022-08-10T14:46:01.597Z"
   }
]
Create Internal Note
 curl --request POST  --header "PRIVATE-TOKEN: PAT" "http://localhost:3000/api/v4/projects/PROJECT_ID/issues/ISSUE_ID/notes?body=testnote&internal=true" | json_pp

{
   "attachment" : null,
   "author" : {
      "avatar_url" : "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "id" : 1,
      "name" : "Administrator",
      "state" : "active",
      "username" : "root",
      "web_url" : "http://127.0.0.1:3000/root"
   },
   "body" : "testnote",
   "commands_changes" : {},
   "confidential" : true,
   "created_at" : "2022-08-11T08:05:15.768Z",
   "id" : 1143,
   "internal" : true,
   "noteable_id" : 436,
   "noteable_iid" : 24,
   "noteable_type" : "Issue",
   "resolvable" : false,
   "system" : false,
   "type" : null,
   "updated_at" : "2022-08-11T08:05:15.768Z"
}

GraphQL API

Receive Note(s)
query Notes {
  project(fullPath:"gitlab-org/sub-group-1/sub-group-2/Flight") {
    issue(iid:"24"){
      notes{
        edges{
          node{
            id
            internal
            confidential
            body
          }
        }
      }
    }
  }
}

Screenshot_2022-08-11_at_10.08.12

Create Note
mutation CreateNote{
  createNote(input:{internal:true, noteableId:"gid://gitlab/Issue/ISSUE_ID", body:"foobar"}) {
    clientMutationId
    note{
      id
      confidential
      internal
      body
    }
  }
}

Screenshot_2022-08-11_at_10.12.41Screenshot_2022-08-11_at_10.12.32

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 Nicolas Dular

Merge request reports