summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/merge_requests
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 08:27:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 08:27:35 +0000
commit7e9c479f7de77702622631cff2628a9c8dcbc627 (patch)
treec8f718a08e110ad7e1894510980d2155a6549197 /app/graphql/mutations/merge_requests
parente852b0ae16db4052c1c567d9efa4facc81146e88 (diff)
downloadgitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/graphql/mutations/merge_requests')
-rw-r--r--app/graphql/mutations/merge_requests/set_labels.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/app/graphql/mutations/merge_requests/set_labels.rb b/app/graphql/mutations/merge_requests/set_labels.rb
index c1e45808593..712c68c9425 100644
--- a/app/graphql/mutations/merge_requests/set_labels.rb
+++ b/app/graphql/mutations/merge_requests/set_labels.rb
@@ -6,7 +6,7 @@ module Mutations
graphql_name 'MergeRequestSetLabels'
argument :label_ids,
- [GraphQL::ID_TYPE],
+ [::Types::GlobalIDType[Label]],
required: true,
description: <<~DESC
The Label IDs to set. Replaces existing labels by default.
@@ -23,10 +23,11 @@ module Mutations
merge_request = authorized_find!(project_path: project_path, iid: iid)
project = merge_request.project
- label_ids = label_ids
- .map { |gid| GlobalID.parse(gid) }
- .select(&method(:label_descendant?))
- .map(&:model_id) # MergeRequests::UpdateService expects integers
+ # 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
+ label_ids = label_ids.compact.map(&:model_id)
attribute_name = case operation_mode
when Types::MutationOperationModeEnum.enum[:append]
@@ -45,10 +46,6 @@ module Mutations
errors: errors_on_object(merge_request)
}
end
-
- def label_descendant?(gid)
- gid&.model_class&.ancestors&.include?(Label)
- end
end
end
end