Commit 5a913e84 authored by Mario Celi's avatar Mario Celi

Add includeSubepics argument to issue filters in GraphQL

Filtering issues already allowed epicId. If includeSubepics
is true, issues associated with the specified epicId or any
of its children will be returned.

Changelog: added
EE: true
parent f8b652b9
......@@ -10305,6 +10305,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="groupissuesepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. |
| <a id="groupissuesiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="groupissuesiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |
| <a id="groupissuesincludesubepics"></a>`includeSubepics` | [`Boolean`](#boolean) | Whether to include subepics when filtering issues by epicId. |
| <a id="groupissuesincludesubgroups"></a>`includeSubgroups` | [`Boolean`](#boolean) | Include issues belonging to subgroups. |
| <a id="groupissuesiterationid"></a>`iterationId` | [`[ID]`](#id) | List of iteration Global IDs applied to the issue. |
| <a id="groupissuesiterationwildcardid"></a>`iterationWildcardId` | [`IterationWildcardId`](#iterationwildcardid) | Filter by iteration ID wildcard. |
......@@ -12740,6 +12741,7 @@ Returns [`Issue`](#issue).
| <a id="projectissueepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. |
| <a id="projectissueiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="projectissueiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |
| <a id="projectissueincludesubepics"></a>`includeSubepics` | [`Boolean`](#boolean) | Whether to include subepics when filtering issues by epicId. |
| <a id="projectissueiterationid"></a>`iterationId` | [`[ID]`](#id) | List of iteration Global IDs applied to the issue. |
| <a id="projectissueiterationwildcardid"></a>`iterationWildcardId` | [`IterationWildcardId`](#iterationwildcardid) | Filter by iteration ID wildcard. |
| <a id="projectissuelabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to this issue. |
......@@ -12810,6 +12812,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| <a id="projectissuesepicid"></a>`epicId` | [`String`](#string) | ID of an epic associated with the issues, "none" and "any" values are supported. |
| <a id="projectissuesiid"></a>`iid` | [`String`](#string) | IID of the issue. For example, "1". |
| <a id="projectissuesiids"></a>`iids` | [`[String!]`](#string) | List of IIDs of issues. For example, `["1", "2"]`. |
| <a id="projectissuesincludesubepics"></a>`includeSubepics` | [`Boolean`](#boolean) | Whether to include subepics when filtering issues by epicId. |
| <a id="projectissuesiterationid"></a>`iterationId` | [`[ID]`](#id) | List of iteration Global IDs applied to the issue. |
| <a id="projectissuesiterationwildcardid"></a>`iterationWildcardId` | [`IterationWildcardId`](#iterationwildcardid) | Filter by iteration ID wildcard. |
| <a id="projectissueslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to this issue. |
......
......@@ -16,6 +16,9 @@ module EE
argument :epic_id, GraphQL::Types::String,
required: false,
description: 'ID of an epic associated with the issues, "none" and "any" values are supported.'
argument :include_subepics, GraphQL::Types::Boolean,
required: false,
description: 'Whether to include subepics when filtering issues by epicId.'
argument :weight, GraphQL::Types::String,
required: false,
description: 'Weight applied to the issue, "none" and "any" values are supported.'
......
......@@ -12,7 +12,7 @@ RSpec.describe Resolvers::IssuesResolver do
context "with a project" do
describe '#resolve' do
let_it_be(:epic1) { create :epic, group: group }
let_it_be(:epic2) { create :epic, group: group }
let_it_be(:epic2) { create :epic, group: group, parent: epic1 }
let_it_be(:iteration1) { create(:iteration, group: group, start_date: 2.weeks.ago, due_date: 1.week.ago) }
let_it_be(:current_iteration) { create(:iteration, group: group, start_date: Date.yesterday, due_date: 1.day.from_now) }
......@@ -134,6 +134,10 @@ RSpec.describe Resolvers::IssuesResolver do
it 'returns issues with any epic when epic_id is specific' do
expect(resolve_issues(epic_id: epic1.id.to_s)).to contain_exactly(issue1)
end
it 'includes issues associated with subepics when specified' do
expect(resolve_issues(epic_id: epic1.id.to_s, include_subepics: true)).to contain_exactly(issue1, issue2)
end
end
describe 'filter by weight' 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