diff options
Diffstat (limited to 'app/graphql/mutations/merge_requests/set_labels.rb')
-rw-r--r-- | app/graphql/mutations/merge_requests/set_labels.rb | 15 |
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 |