Skip to content
Snippets Groups Projects
Commit 5861fc16 authored by Eugenia Grieff's avatar Eugenia Grieff :two:
Browse files

Replace taskable argument with name

Add name argument to workItemTypes GQL field to be able to query a specific type.
Also remove the existing (experimental) taskable argument because it becomes redundant.

Changelog: changed
parent 04a68fe8
No related branches found
No related tags found
2 merge requests!144312Change service start (cut-off) date for code suggestions to March 15th,!140074Add name argument to workItemTypes field
......@@ -7,18 +7,17 @@ class TypesResolver < BaseResolver
type Types::WorkItems::TypeType.connection_type, null: true
argument :taskable, ::GraphQL::Types::Boolean,
required: false,
description: 'If `true`, only taskable work item types will be returned.' \
' Argument is experimental and can be removed in the future without notice.'
argument :name, Types::IssueTypeEnum,
description: 'Filter work item types by the given name.',
required: false
def resolve_with_lookahead(taskable: nil)
def resolve_with_lookahead(name: nil)
context.scoped_set!(:resource_parent, object)
# This will require a finder in the future when groups/projects get their work item types
# All groups/projects use the default types for now
base_scope = ::WorkItems::Type.default
base_scope = base_scope.by_type(:task) if taskable
base_scope = base_scope.by_type(name) if name
apply_lookahead(base_scope.order_by_name_asc)
end
......
......@@ -20593,7 +20593,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
 
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="groupworkitemtypestaskable"></a>`taskable` | [`Boolean`](#boolean) | If `true`, only taskable work item types will be returned. Argument is experimental and can be removed in the future without notice. |
| <a id="groupworkitemtypesname"></a>`name` | [`IssueType`](#issuetype) | Filter work item types by the given name. |
 
##### `Group.workItems`
 
......@@ -26023,7 +26023,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
 
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="projectworkitemtypestaskable"></a>`taskable` | [`Boolean`](#boolean) | If `true`, only taskable work item types will be returned. Argument is experimental and can be removed in the future without notice. |
| <a id="projectworkitemtypesname"></a>`name` | [`IssueType`](#issuetype) | Filter work item types by the given name. |
 
##### `Project.workItems`
 
......@@ -22,10 +22,10 @@
expect(result.to_a).to match(WorkItems::Type.default.order_by_name_asc)
end
context 'when requesting taskable types' do
let(:args) { { taskable: true } }
context 'when filtering by type name' do
let(:args) { { name: 'TASK' } }
it 'returns only taskable types' do
it 'returns type with the given name' do
expect(result.to_a).to contain_exactly(WorkItems::Type.default_by_type(:task))
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment