Commit 1a8e7543 authored by charlie ablett's avatar charlie ablett

Expose state of hidden epic board lists

- Expose via GraphQL
- Add tests
parent cfb9fa65
......@@ -9404,6 +9404,16 @@ type EpicAddIssuePayload {
Represents an epic board
"""
type EpicBoard {
"""
Whether or not backlog list is hidden.
"""
hideBacklogList: Boolean
"""
Whether or not closed list is hidden.
"""
hideClosedList: Boolean
"""
Global ID of the board.
"""
......
......@@ -25849,6 +25849,34 @@
"name": "EpicBoard",
"description": "Represents an epic board",
"fields": [
{
"name": "hideBacklogList",
"description": "Whether or not backlog list is hidden.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "hideClosedList",
"description": "Whether or not closed list is hidden.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "Global ID of the board.",
......@@ -1539,6 +1539,8 @@ Represents an epic board.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `hideBacklogList` | Boolean | Whether or not backlog list is hidden. |
| `hideClosedList` | Boolean | Whether or not closed list is hidden. |
| `id` | BoardsEpicBoardID! | Global ID of the board. |
| `lists` | EpicListConnection | Epic board lists. |
| `name` | String | Name of the board. |
......
......@@ -15,6 +15,13 @@ module Types
field :name, type: GraphQL::STRING_TYPE, null: true,
description: 'Name of the board.'
field :hide_backlog_list, type: GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether or not backlog list is hidden.'
field :hide_closed_list, type: GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether or not closed list is hidden.'
field :lists,
Types::Boards::EpicListType.connection_type,
null: true,
......
......@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['EpicBoard'] do
specify { expect(described_class).to require_graphql_authorizations(:read_epic_board) }
it 'has specific fields' do
expected_fields = %w[id name lists]
expected_fields = %w[id name lists hideBacklogList hideClosedList]
expect(described_class).to include_graphql_fields(*expected_fields)
end
......
......@@ -7,7 +7,7 @@ RSpec.describe 'get list of epic boards' do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group, :private) }
let_it_be(:board1) { create(:epic_board, group: group, name: 'B') }
let_it_be(:board1) { create(:epic_board, group: group, name: 'B', hide_closed_list: true, hide_backlog_list: false) }
let_it_be(:board2) { create(:epic_board, group: group, name: 'A') }
let_it_be(:board3) { create(:epic_board, group: group, name: 'a') }
......@@ -50,6 +50,26 @@ RSpec.describe 'get list of epic boards' do
end
end
context 'field values' do
let(:query) do
graphql_query_for(:group, { fullPath: group.full_path }, query_graphql_field(:epicBoard, { id: board1.to_global_id.to_s }, epic_board_fields))
end
let(:epic_board_fields) do
<<~QUERY
hideBacklogList
hideClosedList
QUERY
end
it 'returns the correct values for hiding board lists' do
post_graphql(query, current_user: current_user)
expect(graphql_data.dig('group', 'epicBoard', 'hideBacklogList')).to eq board1.hide_backlog_list
expect(graphql_data.dig('group', 'epicBoard', 'hideClosedList')).to eq board1.hide_closed_list
end
end
context 'when epic_boards flag is disabled' do
before do
stub_feature_flags(epic_boards: false)
......
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