Commit ee137a76 authored by Jan Provaznik's avatar Jan Provaznik Committed by Igor Drozdov

Expose epic's confidential attribute in GraphQL

Allows listing and setting of this attribute. This feature
is still behind a feature flag and not complete yet. If the flag is
disabled then the attribute is ignored.
parent 1ce3115b
...@@ -467,6 +467,11 @@ input CreateEpicInput { ...@@ -467,6 +467,11 @@ input CreateEpicInput {
""" """
clientMutationId: String clientMutationId: String
"""
Indicates if the epic is confidential. Will be ignored if `confidential_epics` feature flag is disabled
"""
confidential: Boolean
""" """
The description of the epic The description of the epic
""" """
...@@ -2014,6 +2019,11 @@ type Epic implements Noteable { ...@@ -2014,6 +2019,11 @@ type Epic implements Noteable {
""" """
closedAt: Time closedAt: Time
"""
Indicates if the epic is confidential
"""
confidential: Boolean
""" """
Timestamp of the epic's creation Timestamp of the epic's creation
""" """
...@@ -8903,6 +8913,11 @@ input UpdateEpicInput { ...@@ -8903,6 +8913,11 @@ input UpdateEpicInput {
""" """
clientMutationId: String clientMutationId: String
"""
Indicates if the epic is confidential. Will be ignored if `confidential_epics` feature flag is disabled
"""
confidential: Boolean
""" """
The description of the epic The description of the epic
""" """
......
...@@ -1403,6 +1403,16 @@ ...@@ -1403,6 +1403,16 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "confidential",
"description": "Indicates if the epic is confidential. Will be ignored if `confidential_epics` feature flag is disabled",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "startDateFixed", "name": "startDateFixed",
"description": "The start date of the epic", "description": "The start date of the epic",
...@@ -5932,6 +5942,20 @@ ...@@ -5932,6 +5942,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "confidential",
"description": "Indicates if the epic is confidential",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "createdAt", "name": "createdAt",
"description": "Timestamp of the epic's creation", "description": "Timestamp of the epic's creation",
...@@ -27002,6 +27026,16 @@ ...@@ -27002,6 +27026,16 @@
}, },
"defaultValue": null "defaultValue": null
}, },
{
"name": "confidential",
"description": "Indicates if the epic is confidential. Will be ignored if `confidential_epics` feature flag is disabled",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": null
},
{ {
"name": "startDateFixed", "name": "startDateFixed",
"description": "The start date of the epic", "description": "The start date of the epic",
......
...@@ -335,6 +335,7 @@ Represents an epic. ...@@ -335,6 +335,7 @@ Represents an epic.
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `author` | User! | Author of the epic | | `author` | User! | Author of the epic |
| `closedAt` | Time | Timestamp of the epic's closure | | `closedAt` | Time | Timestamp of the epic's closure |
| `confidential` | Boolean | Indicates if the epic is confidential |
| `createdAt` | Time | Timestamp of the epic's creation | | `createdAt` | Time | Timestamp of the epic's creation |
| `descendantCounts` | EpicDescendantCount | Number of open and closed descendant epics and issues | | `descendantCounts` | EpicDescendantCount | Number of open and closed descendant epics and issues |
| `descendantWeightSum` | EpicDescendantWeights | Total weight of open and closed issues in the epic and its descendants | | `descendantWeightSum` | EpicDescendantWeights | Total weight of open and closed issues in the epic and its descendants |
......
...@@ -19,6 +19,11 @@ module Mutations ...@@ -19,6 +19,11 @@ module Mutations
required: false, required: false,
description: 'The description of the epic' description: 'The description of the epic'
argument :confidential,
GraphQL::BOOLEAN_TYPE,
required: false,
description: 'Indicates if the epic is confidential. Will be ignored if `confidential_epics` feature flag is disabled'
argument :start_date_fixed, argument :start_date_fixed,
GraphQL::STRING_TYPE, GraphQL::STRING_TYPE,
required: false, required: false,
......
...@@ -25,6 +25,8 @@ module Types ...@@ -25,6 +25,8 @@ module Types
description: 'Description of the epic' description: 'Description of the epic'
field :state, EpicStateEnum, null: false, field :state, EpicStateEnum, null: false,
description: 'State of the epic' description: 'State of the epic'
field :confidential, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if the epic is confidential'
field :group, GroupType, null: false, field :group, GroupType, null: false,
description: 'Group to which the epic belongs', description: 'Group to which the epic belongs',
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe GitlabSchema.types['Epic'] do describe GitlabSchema.types['Epic'] do
let(:fields) do let(:fields) do
%i[ %i[
id iid title description state group parent author labels id iid title description confidential state group parent author labels
start_date start_date_is_fixed start_date_fixed start_date_from_milestones start_date start_date_is_fixed start_date_fixed start_date_from_milestones
due_date due_date_is_fixed due_date_fixed due_date_from_milestones due_date due_date_is_fixed due_date_fixed due_date_from_milestones
closed_at created_at updated_at children has_children has_issues closed_at created_at updated_at children has_children has_issues
......
...@@ -163,6 +163,7 @@ describe 'Epics through GroupQuery' do ...@@ -163,6 +163,7 @@ describe 'Epics through GroupQuery' do
expect(graphql_errors).to be_nil expect(graphql_errors).to be_nil
expect(epic_data['id']).to eq epic.to_global_id.to_s expect(epic_data['id']).to eq epic.to_global_id.to_s
expect(graphql_data['group']['epicsEnabled']).to be_truthy expect(graphql_data['group']['epicsEnabled']).to be_truthy
expect(epic_data['confidential']).to be_falsey
end end
end end
end end
......
...@@ -15,7 +15,8 @@ describe 'Creating an Epic' do ...@@ -15,7 +15,8 @@ describe 'Creating an Epic' do
start_date_fixed: '2019-09-17', start_date_fixed: '2019-09-17',
due_date_fixed: '2019-09-18', due_date_fixed: '2019-09-18',
start_date_is_fixed: true, start_date_is_fixed: true,
due_date_is_fixed: true due_date_is_fixed: true,
confidential: true
} }
end end
...@@ -73,6 +74,7 @@ describe 'Creating an Epic' do ...@@ -73,6 +74,7 @@ describe 'Creating an Epic' do
expect(epic_hash['startDateIsFixed']).to eq(true) expect(epic_hash['startDateIsFixed']).to eq(true)
expect(epic_hash['dueDateFixed']).to eq('2019-09-18') expect(epic_hash['dueDateFixed']).to eq('2019-09-18')
expect(epic_hash['dueDateIsFixed']).to eq(true) expect(epic_hash['dueDateIsFixed']).to eq(true)
expect(epic_hash['confidential']).to eq(true)
end end
context 'when there are ActiveRecord validation errors' do context 'when there are ActiveRecord validation errors' do
...@@ -96,6 +98,19 @@ describe 'Creating an Epic' do ...@@ -96,6 +98,19 @@ describe 'Creating an Epic' do
expect { post_graphql_mutation(mutation, current_user: current_user) }.not_to change(Epic, :count) expect { post_graphql_mutation(mutation, current_user: current_user) }.not_to change(Epic, :count)
end end
end end
context 'when confidential_epics is disabled' do
before do
stub_feature_flags(confidential_epics: false)
end
it 'ignores confidential field' do
post_graphql_mutation(mutation, current_user: current_user)
epic_hash = mutation_response['epic']
expect(epic_hash['confidential']).to be_falsey
end
end
end end
end end
end end
...@@ -19,7 +19,8 @@ describe Mutations::Epics::Update do ...@@ -19,7 +19,8 @@ describe Mutations::Epics::Update do
start_date_fixed: '2019-09-17', start_date_fixed: '2019-09-17',
due_date_fixed: '2019-09-18', due_date_fixed: '2019-09-18',
start_date_is_fixed: true, start_date_is_fixed: true,
due_date_is_fixed: true due_date_is_fixed: true,
confidential: true
} }
end end
...@@ -79,6 +80,7 @@ describe Mutations::Epics::Update do ...@@ -79,6 +80,7 @@ describe Mutations::Epics::Update do
expect(epic_hash['startDateIsFixed']).to eq(true) expect(epic_hash['startDateIsFixed']).to eq(true)
expect(epic_hash['dueDateFixed']).to eq('2019-09-18') expect(epic_hash['dueDateFixed']).to eq('2019-09-18')
expect(epic_hash['dueDateIsFixed']).to eq(true) expect(epic_hash['dueDateIsFixed']).to eq(true)
expect(epic_hash['confidential']).to eq(true)
end end
context 'when closing the epic' do context 'when closing the epic' do
...@@ -132,6 +134,19 @@ describe Mutations::Epics::Update do ...@@ -132,6 +134,19 @@ describe Mutations::Epics::Update do
it_behaves_like 'a mutation that returns top-level errors', it_behaves_like 'a mutation that returns top-level errors',
errors: ['The list of epic attributes is empty'] errors: ['The list of epic attributes is empty']
end end
context 'when confidential_epics is disabled' do
before do
stub_feature_flags(confidential_epics: false)
end
it 'ignores confidential field' do
post_graphql_mutation(mutation, current_user: current_user)
epic_hash = mutation_response['epic']
expect(epic_hash['confidential']).to be_falsey
end
end
end end
end end
end end
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