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 {
"""
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
"""
......@@ -2014,6 +2019,11 @@ type Epic implements Noteable {
"""
closedAt: Time
"""
Indicates if the epic is confidential
"""
confidential: Boolean
"""
Timestamp of the epic's creation
"""
......@@ -8903,6 +8913,11 @@ input UpdateEpicInput {
"""
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
"""
......
......@@ -1403,6 +1403,16 @@
},
"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",
"description": "The start date of the epic",
......@@ -5932,6 +5942,20 @@
"isDeprecated": false,
"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",
"description": "Timestamp of the epic's creation",
......@@ -27002,6 +27026,16 @@
},
"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",
"description": "The start date of the epic",
......
......@@ -335,6 +335,7 @@ Represents an epic.
| --- | ---- | ---------- |
| `author` | User! | Author of the epic |
| `closedAt` | Time | Timestamp of the epic's closure |
| `confidential` | Boolean | Indicates if the epic is confidential |
| `createdAt` | Time | Timestamp of the epic's creation |
| `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 |
......
......@@ -19,6 +19,11 @@ module Mutations
required: false,
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,
GraphQL::STRING_TYPE,
required: false,
......
......@@ -25,6 +25,8 @@ module Types
description: 'Description of the epic'
field :state, EpicStateEnum, null: false,
description: 'State of the epic'
field :confidential, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if the epic is confidential'
field :group, GroupType, null: false,
description: 'Group to which the epic belongs',
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe GitlabSchema.types['Epic'] do
let(:fields) do
%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
due_date due_date_is_fixed due_date_fixed due_date_from_milestones
closed_at created_at updated_at children has_children has_issues
......
......@@ -163,6 +163,7 @@ describe 'Epics through GroupQuery' do
expect(graphql_errors).to be_nil
expect(epic_data['id']).to eq epic.to_global_id.to_s
expect(graphql_data['group']['epicsEnabled']).to be_truthy
expect(epic_data['confidential']).to be_falsey
end
end
end
......
......@@ -15,7 +15,8 @@ describe 'Creating an Epic' do
start_date_fixed: '2019-09-17',
due_date_fixed: '2019-09-18',
start_date_is_fixed: true,
due_date_is_fixed: true
due_date_is_fixed: true,
confidential: true
}
end
......@@ -73,6 +74,7 @@ describe 'Creating an Epic' do
expect(epic_hash['startDateIsFixed']).to eq(true)
expect(epic_hash['dueDateFixed']).to eq('2019-09-18')
expect(epic_hash['dueDateIsFixed']).to eq(true)
expect(epic_hash['confidential']).to eq(true)
end
context 'when there are ActiveRecord validation errors' do
......@@ -96,6 +98,19 @@ describe 'Creating an Epic' do
expect { post_graphql_mutation(mutation, current_user: current_user) }.not_to change(Epic, :count)
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
......@@ -19,7 +19,8 @@ describe Mutations::Epics::Update do
start_date_fixed: '2019-09-17',
due_date_fixed: '2019-09-18',
start_date_is_fixed: true,
due_date_is_fixed: true
due_date_is_fixed: true,
confidential: true
}
end
......@@ -79,6 +80,7 @@ describe Mutations::Epics::Update do
expect(epic_hash['startDateIsFixed']).to eq(true)
expect(epic_hash['dueDateFixed']).to eq('2019-09-18')
expect(epic_hash['dueDateIsFixed']).to eq(true)
expect(epic_hash['confidential']).to eq(true)
end
context 'when closing the epic' do
......@@ -132,6 +134,19 @@ describe Mutations::Epics::Update do
it_behaves_like 'a mutation that returns top-level errors',
errors: ['The list of epic attributes is empty']
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
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