summaryrefslogtreecommitdiff
path: root/app/graphql/mutations
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-17 00:09:32 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-17 00:09:32 +0000
commit1b1bd461da768b31adb730f42060b7d6adf548c5 (patch)
treef0150b942ee4e9f5798418aad6da669de6ace00b /app/graphql/mutations
parent2c34e41161b78fddbdff9a858086e95558e06ba0 (diff)
downloadgitlab-ce-1b1bd461da768b31adb730f42060b7d6adf548c5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/mutations')
-rw-r--r--app/graphql/mutations/issues/bulk_update.rb28
1 files changed, 25 insertions, 3 deletions
diff --git a/app/graphql/mutations/issues/bulk_update.rb b/app/graphql/mutations/issues/bulk_update.rb
index 5d72a9372c9..7f3d5f6ffb2 100644
--- a/app/graphql/mutations/issues/bulk_update.rb
+++ b/app/graphql/mutations/issues/bulk_update.rb
@@ -27,6 +27,10 @@ module Mutations
description: 'Global ID array of the users that will be assigned to the given issues. ' \
'Existing assignees will be replaced with the ones on this list.'
+ argument :milestone_id, ::Types::GlobalIDType[::Milestone],
+ required: false,
+ description: 'Global ID of the milestone that will be assigned to the issues.'
+
field :updated_issue_count, GraphQL::Types::Int,
null: true,
description: 'Number of issues that were successfully updated.'
@@ -71,14 +75,32 @@ module Mutations
def prepared_params(attributes, ids)
prepared = { issuable_ids: model_ids_from(ids).uniq }
- prepared[:assignee_ids] = model_ids_from(attributes[:assignee_ids]) if attributes[:assignee_ids]
- prepared
+ global_id_arguments.each do |argument|
+ next unless attributes.key?(argument)
+
+ prepared[argument] = model_ids_from(attributes[argument])
+ end
+
+ prepared.transform_keys(param_mappings)
+ end
+
+ def param_mappings
+ {}
+ end
+
+ def global_id_arguments
+ %i[assignee_ids milestone_id]
end
def model_ids_from(attributes)
- attributes.map(&:model_id)
+ return if attributes.nil?
+ return attributes.map(&:model_id) if attributes.is_a?(Array)
+
+ attributes.model_id
end
end
end
end
+
+Mutations::Issues::BulkUpdate.prepend_mod