Commit 2a59e064 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '268152-add-graphql-field-filter-issues-by-issue_type-in-issue-boards' into 'master'

Add filtering by issue type for issues boards in GraphQL

See merge request gitlab-org/gitlab!66871
parents 524564af 357de2d7
...@@ -19,6 +19,11 @@ module Types ...@@ -19,6 +19,11 @@ module Types
argument :release_tag, GraphQL::Types::String, argument :release_tag, GraphQL::Types::String,
required: false, required: false,
description: 'Filter by release tag.' description: 'Filter by release tag.'
argument :types, [Types::IssueTypeEnum],
as: :issue_types,
description: 'Filter by the given issue types.',
required: false
end end
end end
end end
......
...@@ -42,7 +42,7 @@ module Boards ...@@ -42,7 +42,7 @@ module Boards
end end
def set_issue_types def set_issue_types
params[:issue_types] = Issue::TYPES_FOR_LIST params[:issue_types] ||= Issue::TYPES_FOR_LIST
end end
def item_model def item_model
......
...@@ -16584,6 +16584,7 @@ Field that are available while modifying the custom mapping attributes for an HT ...@@ -16584,6 +16584,7 @@ Field that are available while modifying the custom mapping attributes for an HT
| <a id="boardissueinputnot"></a>`not` | [`NegatedBoardIssueInput`](#negatedboardissueinput) | List of negated arguments. | | <a id="boardissueinputnot"></a>`not` | [`NegatedBoardIssueInput`](#negatedboardissueinput) | List of negated arguments. |
| <a id="boardissueinputreleasetag"></a>`releaseTag` | [`String`](#string) | Filter by release tag. | | <a id="boardissueinputreleasetag"></a>`releaseTag` | [`String`](#string) | Filter by release tag. |
| <a id="boardissueinputsearch"></a>`search` | [`String`](#string) | Search query for issue title or description. | | <a id="boardissueinputsearch"></a>`search` | [`String`](#string) | Search query for issue title or description. |
| <a id="boardissueinputtypes"></a>`types` | [`[IssueType!]`](#issuetype) | Filter by the given issue types. |
| <a id="boardissueinputweight"></a>`weight` | [`String`](#string) | Filter by weight. | | <a id="boardissueinputweight"></a>`weight` | [`String`](#string) | Filter by weight. |
| <a id="boardissueinputweightwildcardid"></a>`weightWildcardId` | [`WeightWildcardId`](#weightwildcardid) | Filter by weight ID wildcard. Incompatible with weight. | | <a id="boardissueinputweightwildcardid"></a>`weightWildcardId` | [`WeightWildcardId`](#weightwildcardid) | Filter by weight ID wildcard. Incompatible with weight. |
...@@ -16736,6 +16737,7 @@ Represents an escalation rule. ...@@ -16736,6 +16737,7 @@ Represents an escalation rule.
| <a id="negatedboardissueinputmilestonetitle"></a>`milestoneTitle` | [`String`](#string) | Filter by milestone title. | | <a id="negatedboardissueinputmilestonetitle"></a>`milestoneTitle` | [`String`](#string) | Filter by milestone title. |
| <a id="negatedboardissueinputmyreactionemoji"></a>`myReactionEmoji` | [`String`](#string) | Filter by reaction emoji applied by the current user. | | <a id="negatedboardissueinputmyreactionemoji"></a>`myReactionEmoji` | [`String`](#string) | Filter by reaction emoji applied by the current user. |
| <a id="negatedboardissueinputreleasetag"></a>`releaseTag` | [`String`](#string) | Filter by release tag. | | <a id="negatedboardissueinputreleasetag"></a>`releaseTag` | [`String`](#string) | Filter by release tag. |
| <a id="negatedboardissueinputtypes"></a>`types` | [`[IssueType!]`](#issuetype) | Filter by the given issue types. |
| <a id="negatedboardissueinputweight"></a>`weight` | [`String`](#string) | Filter by weight. | | <a id="negatedboardissueinputweight"></a>`weight` | [`String`](#string) | Filter by weight. |
### `NegatedEpicBoardIssueInput` ### `NegatedEpicBoardIssueInput`
......
...@@ -55,6 +55,15 @@ RSpec.describe Boards::Issues::ListService do ...@@ -55,6 +55,15 @@ RSpec.describe Boards::Issues::ListService do
it_behaves_like 'issues list service' it_behaves_like 'issues list service'
end end
context 'when filtering by type' do
it 'only returns the specified type' do
issue = create(:labeled_issue, project: project, milestone: m1, labels: [development, p1], issue_type: 'incident')
params = { board_id: board.id, id: list1.id, issue_types: 'incident' }
expect(described_class.new(parent, user, params).execute).to eq [issue]
end
end
end end
# rubocop: disable RSpec/MultipleMemoizedHelpers # rubocop: disable RSpec/MultipleMemoizedHelpers
......
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