diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 00:09:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-17 00:09:32 +0000 |
commit | 1b1bd461da768b31adb730f42060b7d6adf548c5 (patch) | |
tree | f0150b942ee4e9f5798418aad6da669de6ace00b /app/graphql/mutations | |
parent | 2c34e41161b78fddbdff9a858086e95558e06ba0 (diff) | |
download | gitlab-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.rb | 28 |
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 |