Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
17c23766
Commit
17c23766
authored
Mar 12, 2021
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'board_args_consolidation' into 'master'"
This reverts merge request !55982
parent
e04a76b2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
64 additions
and
115 deletions
+64
-115
app/graphql/mutations/boards/create.rb
app/graphql/mutations/boards/create.rb
+1
-1
changelogs/unreleased/board_args_consolidation.yml
changelogs/unreleased/board_args_consolidation.yml
+0
-5
ee/app/graphql/ee/mutations/boards/create.rb
ee/app/graphql/ee/mutations/boards/create.rb
+2
-2
ee/app/graphql/ee/mutations/boards/scoped_board_arguments.rb
ee/app/graphql/ee/mutations/boards/scoped_board_arguments.rb
+45
-0
ee/app/graphql/ee/mutations/boards/update.rb
ee/app/graphql/ee/mutations/boards/update.rb
+2
-2
ee/app/graphql/mutations/boards/epic_boards/create.rb
ee/app/graphql/mutations/boards/epic_boards/create.rb
+1
-2
ee/app/graphql/mutations/boards/epic_boards/update.rb
ee/app/graphql/mutations/boards/epic_boards/update.rb
+8
-0
ee/app/graphql/mutations/boards/scoped_board_mutation.rb
ee/app/graphql/mutations/boards/scoped_board_mutation.rb
+0
-10
ee/app/graphql/mutations/boards/scoped_issue_board_arguments.rb
.../graphql/mutations/boards/scoped_issue_board_arguments.rb
+0
-35
ee/spec/graphql/mutations/boards/epic_boards/create_spec.rb
ee/spec/graphql/mutations/boards/epic_boards/create_spec.rb
+1
-1
ee/spec/requests/api/graphql/mutations/boards/epic_boards/create_spec.rb
...s/api/graphql/mutations/boards/epic_boards/create_spec.rb
+0
-55
spec/support/shared_examples/graphql/mutations/boards_create_shared_examples.rb
...amples/graphql/mutations/boards_create_shared_examples.rb
+4
-2
No files found.
app/graphql/mutations/boards/create.rb
View file @
17c23766
...
...
@@ -22,7 +22,7 @@ module Mutations
response
=
::
Boards
::
CreateService
.
new
(
board_parent
,
current_user
,
args
).
execute
{
board:
response
.
success?
?
response
.
payload
:
nil
,
board:
response
.
payload
,
errors:
response
.
errors
}
end
...
...
changelogs/unreleased/board_args_consolidation.yml
deleted
100644 → 0
View file @
e04a76b2
---
title
:
Fixed error handling GraphQL API when issue board creation fails
merge_request
:
55982
author
:
type
:
fixed
ee/app/graphql/ee/mutations/boards/create.rb
View file @
17c23766
...
...
@@ -5,10 +5,10 @@ module EE
module
Boards
module
Create
extend
ActiveSupport
::
Concern
prepend
::
Mutations
::
Boards
::
ScopedBoardMutation
prepended
do
prepend
::
Mutations
::
Boards
::
ScopedIssueBoardArguments
prepend
::
Mutations
::
Boards
::
ScopedBoardMutation
include
Mutations
::
Boards
::
ScopedBoardArguments
end
end
end
...
...
ee/app/graphql/ee/mutations/boards/scoped_board_arguments.rb
0 → 100644
View file @
17c23766
# frozen_string_literal: true
module
EE
module
Mutations
module
Boards
module
ScopedBoardArguments
extend
ActiveSupport
::
Concern
included
do
argument
:assignee_id
,
::
Types
::
GlobalIDType
[
::
User
],
required:
false
,
description:
'The ID of user to be assigned to the board.'
# Cannot pre-load ::Types::MilestoneType because we are also assigning values like:
# ::Timebox::None(0), ::Timebox::Upcoming(-2) or ::Timebox::Started(-3), that cannot be resolved to a DB record.
argument
:milestone_id
,
::
Types
::
GlobalIDType
[
::
Milestone
],
required:
false
,
description:
'The ID of milestone to be assigned to the board.'
# Cannot pre-load ::Types::IterationType because we are also assigning values like:
# ::Iteration::Predefined::None(0) or ::Iteration::Predefined::Current(-4), that cannot be resolved to a DB record.
argument
:iteration_id
,
::
Types
::
GlobalIDType
[
::
Iteration
],
required:
false
,
description:
'The ID of iteration to be assigned to the board.'
argument
:weight
,
GraphQL
::
INT_TYPE
,
required:
false
,
description:
'The weight value to be assigned to the board.'
argument
:labels
,
[
GraphQL
::
STRING_TYPE
],
required:
false
,
description:
copy_field_description
(
::
Types
::
IssueType
,
:labels
)
argument
:label_ids
,
[
::
Types
::
GlobalIDType
[
::
Label
]],
required:
false
,
description:
'The IDs of labels to be added to the board.'
end
end
end
end
end
ee/app/graphql/ee/mutations/boards/update.rb
View file @
17c23766
...
...
@@ -5,10 +5,10 @@ module EE
module
Boards
module
Update
extend
ActiveSupport
::
Concern
prepend
::
Mutations
::
Boards
::
ScopedBoardMutation
prepended
do
prepend
::
Mutations
::
Boards
::
ScopedIssueBoardArguments
prepend
::
Mutations
::
Boards
::
ScopedBoardMutation
include
Mutations
::
Boards
::
ScopedBoardArguments
end
end
end
...
...
ee/app/graphql/mutations/boards/epic_boards/create.rb
View file @
17c23766
...
...
@@ -6,7 +6,6 @@ module Mutations
class
Create
<
::
Mutations
::
BaseMutation
include
Mutations
::
ResolvesGroup
include
Mutations
::
Boards
::
CommonMutationArguments
prepend
Mutations
::
Boards
::
ScopedBoardMutation
graphql_name
'EpicBoardCreate'
...
...
@@ -28,7 +27,7 @@ module Mutations
service_response
=
::
Boards
::
EpicBoards
::
CreateService
.
new
(
group
,
current_user
,
args
).
execute
{
epic_board:
service_response
.
success?
?
service_response
.
payload
:
nil
,
epic_board:
service_response
.
payload
,
errors:
service_response
.
errors
}
end
...
...
ee/app/graphql/mutations/boards/epic_boards/update.rb
View file @
17c23766
...
...
@@ -16,6 +16,14 @@ module Mutations
required:
true
,
description:
'The epic board global ID.'
argument
:labels
,
[
GraphQL
::
STRING_TYPE
],
required:
false
,
description:
'Labels to be added to the board.'
argument
:label_ids
,
[
::
Types
::
GlobalIDType
[
::
Label
]],
required:
false
,
description:
'The IDs of labels to be added to the board.'
field
:epic_board
,
Types
::
Boards
::
EpicBoardType
,
null:
true
,
...
...
ee/app/graphql/mutations/boards/scoped_board_mutation.rb
View file @
17c23766
...
...
@@ -5,16 +5,6 @@ module Mutations
module
ScopedBoardMutation
extend
ActiveSupport
::
Concern
prepended
do
argument
:labels
,
[
GraphQL
::
STRING_TYPE
],
required:
false
,
description:
copy_field_description
(
::
Types
::
IssueType
,
:labels
)
argument
:label_ids
,
[
::
Types
::
GlobalIDType
[
::
Label
]],
required:
false
,
description:
'IDs of labels to be added to the board.'
end
def
resolve
(
**
args
)
parsed_params
=
parse_arguments
(
args
)
...
...
ee/app/graphql/mutations/boards/scoped_issue_board_arguments.rb
deleted
100644 → 0
View file @
e04a76b2
# frozen_string_literal: true
module
Mutations
module
Boards
module
ScopedIssueBoardArguments
extend
ActiveSupport
::
Concern
prepended
do
argument
:assignee_id
,
::
Types
::
GlobalIDType
[
::
User
],
required:
false
,
description:
'ID of user to be assigned to the board.'
# Cannot pre-load ::Types::MilestoneType because we are also assigning values like:
# ::Timebox::None(0), ::Timebox::Upcoming(-2) or ::Timebox::Started(-3), that cannot be resolved to a DB record.
argument
:milestone_id
,
::
Types
::
GlobalIDType
[
::
Milestone
],
required:
false
,
description:
'ID of milestone to be assigned to the board.'
# Cannot pre-load ::Types::IterationType because we are also assigning values like:
# ::Iteration::Predefined::None(0) or ::Iteration::Predefined::Current(-4), that cannot be resolved to a DB record.
argument
:iteration_id
,
::
Types
::
GlobalIDType
[
::
Iteration
],
required:
false
,
description:
'ID of iteration to be assigned to the board.'
argument
:weight
,
GraphQL
::
INT_TYPE
,
required:
false
,
description:
'Weight value to be assigned to the board.'
end
end
end
end
ee/spec/graphql/mutations/boards/epic_boards/create_spec.rb
View file @
17c23766
...
...
@@ -23,7 +23,7 @@ RSpec.describe ::Mutations::Boards::EpicBoards::Create do
context
'field tests'
do
subject
{
described_class
}
it
{
is_expected
.
to
have_graphql_arguments
(
:groupPath
,
:name
,
:hideBacklogList
,
:hideClosedList
,
:labels
,
:labelIds
)
}
it
{
is_expected
.
to
have_graphql_arguments
(
:groupPath
,
:name
,
:hideBacklogList
,
:hideClosedList
)
}
it
{
is_expected
.
to
have_graphql_fields
(
:epic_board
).
at_least
}
end
...
...
ee/spec/requests/api/graphql/mutations/boards/epic_boards/create_spec.rb
deleted
100644 → 0
View file @
e04a76b2
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Mutations
::
Boards
::
EpicBoards
::
Create
do
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:name
)
{
'board name'
}
let
(
:mutation
)
{
graphql_mutation
(
:epic_board_create
,
params
)
}
let
(
:label
)
{
create
(
:group_label
,
group:
group
)
}
let
(
:params
)
{
{
groupPath:
group
.
full_path
,
name:
'foo'
,
hide_backlog_list:
true
,
labels:
[
label
.
name
]
}
}
subject
{
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
}
def
mutation_response
graphql_mutation_response
(
:epic_board_create
)
end
before
do
stub_licensed_features
(
epics:
true
,
scoped_issue_board:
true
)
end
context
'when the user does not have permission'
do
it_behaves_like
'a mutation that returns a top-level access error'
end
context
'when the user has permission'
do
before
do
group
.
add_developer
(
current_user
)
end
it
'returns the created board'
do
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
expect
(
mutation_response
).
to
have_key
(
'epicBoard'
)
expect
(
mutation_response
[
'epicBoard'
][
'name'
]).
to
eq
(
params
[
:name
])
expect
(
mutation_response
[
'epicBoard'
][
'hideBacklogList'
]).
to
eq
(
params
[
:hide_backlog_list
])
expect
(
mutation_response
[
'epicBoard'
][
'labels'
][
'count'
]).
to
eq
(
1
)
end
context
'when create fails'
do
let
(
:params
)
{
{
groupPath:
group
.
full_path
,
name:
'x'
*
256
}
}
it
'returns an error'
do
post_graphql_mutation
(
mutation
,
current_user:
current_user
)
expect
(
mutation_response
).
to
have_key
(
'epicBoard'
)
expect
(
mutation_response
[
'epicBoard'
]).
to
be_nil
expect
(
mutation_response
[
'errors'
].
first
).
to
eq
(
'There was an error when creating a board.'
)
end
end
end
end
spec/support/shared_examples/graphql/mutations/boards_create_shared_examples.rb
View file @
17c23766
...
...
@@ -66,7 +66,9 @@ RSpec.shared_examples 'boards create mutation' do
context
'when the Boards::CreateService returns an error response'
do
before
do
params
[
:name
]
=
''
allow_next_instance_of
(
Boards
::
CreateService
)
do
|
service
|
allow
(
service
).
to
receive
(
:execute
).
and_return
(
ServiceResponse
.
error
(
message:
'There was an error.'
))
end
end
it
'does not create a board'
do
...
...
@@ -78,7 +80,7 @@ RSpec.shared_examples 'boards create mutation' do
expect
(
mutation_response
).
to
have_key
(
'board'
)
expect
(
mutation_response
[
'board'
]).
to
be_nil
expect
(
mutation_response
[
'errors'
].
first
).
to
eq
(
'There was an error
when creating a board
.'
)
expect
(
mutation_response
[
'errors'
].
first
).
to
eq
(
'There was an error.'
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment