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
2a619ffa
Commit
2a619ffa
authored
Oct 21, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add coercions for backwards compatibility
parent
9d72822b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
app/graphql/mutations/merge_requests/set_labels.rb
app/graphql/mutations/merge_requests/set_labels.rb
+3
-0
app/graphql/resolvers/concerns/resolves_project.rb
app/graphql/resolvers/concerns/resolves_project.rb
+3
-0
app/graphql/resolvers/user_merge_requests_resolver.rb
app/graphql/resolvers/user_merge_requests_resolver.rb
+5
-3
No files found.
app/graphql/mutations/merge_requests/set_labels.rb
View file @
2a619ffa
...
@@ -23,6 +23,9 @@ module Mutations
...
@@ -23,6 +23,9 @@ module Mutations
merge_request
=
authorized_find!
(
project_path:
project_path
,
iid:
iid
)
merge_request
=
authorized_find!
(
project_path:
project_path
,
iid:
iid
)
project
=
merge_request
.
project
project
=
merge_request
.
project
# TODO: remove this line when the compatibility layer is removed:
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
label_ids
=
label_ids
.
map
{
|
id
|
::
Types
::
GlobalIDType
[
::
Label
].
coerce_isolated_input
(
id
)
}
# MergeRequests::UpdateService expects integers
# MergeRequests::UpdateService expects integers
label_ids
=
label_ids
.
compact
.
map
(
&
:model_id
)
label_ids
=
label_ids
.
compact
.
map
(
&
:model_id
)
...
...
app/graphql/resolvers/concerns/resolves_project.rb
View file @
2a619ffa
# frozen_string_literal: true
# frozen_string_literal: true
module
ResolvesProject
module
ResolvesProject
# Accepts EITHER one of
# - full_path: String (see Project#full_path)
# - project_id: GlobalID. Arguments should be typed as: `::Types::GlobalIDType[Project]`
def
resolve_project
(
full_path:
nil
,
project_id:
nil
)
def
resolve_project
(
full_path:
nil
,
project_id:
nil
)
unless
full_path
.
present?
^
project_id
.
present?
unless
full_path
.
present?
^
project_id
.
present?
raise
::
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
'Incompatible arguments: projectId, projectPath.'
raise
::
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
'Incompatible arguments: projectId, projectPath.'
...
...
app/graphql/resolvers/user_merge_requests_resolver.rb
View file @
2a619ffa
...
@@ -8,7 +8,7 @@ module Resolvers
...
@@ -8,7 +8,7 @@ module Resolvers
required:
false
,
required:
false
,
description:
'The full-path of the project the authored merge requests should be in. Incompatible with projectId.'
description:
'The full-path of the project the authored merge requests should be in. Incompatible with projectId.'
argument
:project_id
,
GraphQL
::
ID_TYPE
,
argument
:project_id
,
::
Types
::
GlobalIDType
[
::
Project
]
,
required:
false
,
required:
false
,
description:
'The global ID of the project the authored merge requests should be in. Incompatible with projectPath.'
description:
'The global ID of the project the authored merge requests should be in. Incompatible with projectPath.'
...
@@ -50,8 +50,10 @@ module Resolvers
...
@@ -50,8 +50,10 @@ module Resolvers
end
end
def
load_project
(
project_path
,
project_id
)
def
load_project
(
project_path
,
project_id
)
@project
=
resolve_project
(
full_path:
project_path
,
project_id:
project_id
)
# TODO: remove this line when the compatibility layer is removed
@project
=
@project
.
sync
if
@project
.
respond_to?
(
:sync
)
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
project_id
&&=
::
Types
::
GlobalIDType
[
::
Project
].
coerce_isolated_input
(
project_id
)
@project
=
::
Gitlab
::
Graphql
::
Lazy
.
force
(
resolve_project
(
full_path:
project_path
,
project_id:
project_id
))
end
end
def
no_results_possible?
(
args
)
def
no_results_possible?
(
args
)
...
...
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