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
747667a3
Commit
747667a3
authored
Jun 02, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid parsing global-ids multiple times
parent
c77700ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/graphql/mutations/merge_requests/set_labels.rb
app/graphql/mutations/merge_requests/set_labels.rb
+3
-2
No files found.
app/graphql/mutations/merge_requests/set_labels.rb
View file @
747667a3
...
...
@@ -24,8 +24,9 @@ module Mutations
project
=
merge_request
.
project
label_ids
=
label_ids
.
map
{
|
gid
|
GlobalID
.
parse
(
gid
)
}
.
select
(
&
method
(
:label_descendant?
))
.
map
{
|
gid
|
GlobalID
.
parse
(
gid
).
model_id
}
# MergeRequests::UpdateService expects integers
.
map
(
&
:model_id
)
# MergeRequests::UpdateService expects integers
attribute_name
=
case
operation_mode
when
Types
::
MutationOperationModeEnum
.
enum
[
:append
]
...
...
@@ -46,7 +47,7 @@ module Mutations
end
def
label_descendant?
(
gid
)
GlobalID
.
parse
(
gid
)
&
.
model_class
&
.
ancestors
&
.
include?
(
Label
)
gid
&
.
model_class
&
.
ancestors
&
.
include?
(
Label
)
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