Commit 2262bd1c authored by Jarka Košanová's avatar Jarka Košanová

Add confidential to graphQL for notes creation

- optional confidentional param
- update the documentation
parent 362fa7b9
...@@ -18,6 +18,11 @@ module Mutations ...@@ -18,6 +18,11 @@ module Mutations
required: true, required: true,
description: copy_field_description(Types::Notes::NoteType, :body) description: copy_field_description(Types::Notes::NoteType, :body)
argument :confidential,
GraphQL::BOOLEAN_TYPE,
required: false,
description: 'The confidentiality flag of a note. Default is false.'
def resolve(args) def resolve(args)
noteable = authorized_find!(id: args[:noteable_id]) noteable = authorized_find!(id: args[:noteable_id])
...@@ -40,7 +45,8 @@ module Mutations ...@@ -40,7 +45,8 @@ module Mutations
def create_note_params(noteable, args) def create_note_params(noteable, args)
{ {
noteable: noteable, noteable: noteable,
note: args[:body] note: args[:body],
confidential: args[:confidential]
} }
end end
end end
......
---
title: Add confidential attribute to graphQL for notes creation
merge_request: 36799
author:
type: added
...@@ -1691,6 +1691,11 @@ input CreateDiffNoteInput { ...@@ -1691,6 +1691,11 @@ input CreateDiffNoteInput {
""" """
clientMutationId: String clientMutationId: String
"""
The confidentiality flag of a note. Default is false.
"""
confidential: Boolean
""" """
The global id of the resource to add a note to The global id of the resource to add a note to
""" """
...@@ -1816,6 +1821,11 @@ input CreateImageDiffNoteInput { ...@@ -1816,6 +1821,11 @@ input CreateImageDiffNoteInput {
""" """
clientMutationId: String clientMutationId: String
"""
The confidentiality flag of a note. Default is false.
"""
confidential: Boolean
""" """
The global id of the resource to add a note to The global id of the resource to add a note to
""" """
...@@ -1916,6 +1926,11 @@ input CreateNoteInput { ...@@ -1916,6 +1926,11 @@ input CreateNoteInput {
""" """
clientMutationId: String clientMutationId: String
"""
The confidentiality flag of a note. Default is false.
"""
confidential: Boolean
""" """
The global id of the discussion this note is in reply to The global id of the discussion this note is in reply to
""" """
......
...@@ -4496,6 +4496,16 @@ ...@@ -4496,6 +4496,16 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "confidential",
"description": "The confidentiality flag of a note. Default is false.",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "position", "name": "position",
"description": "The position of this note on a diff", "description": "The position of this note on a diff",
...@@ -4834,6 +4844,16 @@ ...@@ -4834,6 +4844,16 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "confidential",
"description": "The confidentiality flag of a note. Default is false.",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "position", "name": "position",
"description": "The position of this note on a diff", "description": "The position of this note on a diff",
...@@ -5106,6 +5126,16 @@ ...@@ -5106,6 +5126,16 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "confidential",
"description": "The confidentiality flag of a note. Default is false.",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "discussionId", "name": "discussionId",
"description": "The global id of the discussion this note is in reply to", "description": "The global id of the discussion this note is in reply to",
...@@ -13,7 +13,8 @@ RSpec.describe 'Adding a Note' do ...@@ -13,7 +13,8 @@ RSpec.describe 'Adding a Note' do
variables = { variables = {
noteable_id: GitlabSchema.id_from_object(noteable).to_s, noteable_id: GitlabSchema.id_from_object(noteable).to_s,
discussion_id: (GitlabSchema.id_from_object(discussion).to_s if discussion), discussion_id: (GitlabSchema.id_from_object(discussion).to_s if discussion),
body: 'Body text' body: 'Body text',
confidential: true
} }
graphql_mutation(:create_note, variables) graphql_mutation(:create_note, variables)
...@@ -40,6 +41,7 @@ RSpec.describe 'Adding a Note' do ...@@ -40,6 +41,7 @@ RSpec.describe 'Adding a Note' do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
expect(mutation_response['note']['body']).to eq('Body text') expect(mutation_response['note']['body']).to eq('Body text')
expect(mutation_response['note']['confidential']).to eq(true)
end end
describe 'creating Notes in reply to a discussion' do describe 'creating Notes in reply to a discussion' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment