Commit 747667a3 authored by Alex Kalderimis's avatar Alex Kalderimis

Avoid parsing global-ids multiple times

parent c77700ce
......@@ -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
......
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