Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/ci/pipeline_schedule/update.rb')
-rw-r--r--app/graphql/mutations/ci/pipeline_schedule/update.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/graphql/mutations/ci/pipeline_schedule/update.rb b/app/graphql/mutations/ci/pipeline_schedule/update.rb
index a0b5e793ecb..aff0a5494e7 100644
--- a/app/graphql/mutations/ci/pipeline_schedule/update.rb
+++ b/app/graphql/mutations/ci/pipeline_schedule/update.rb
@@ -43,7 +43,7 @@ module Mutations
def resolve(id:, variables: [], **pipeline_schedule_attrs)
schedule = authorized_find!(id: id)
- params = pipeline_schedule_attrs.merge(variables_attributes: variables.map(&:to_h))
+ params = pipeline_schedule_attrs.merge(variables_attributes: variable_attributes_for(variables))
service_response = ::Ci::PipelineSchedules::UpdateService
.new(schedule, current_user, params)
@@ -54,6 +54,18 @@ module Mutations
errors: service_response.errors
}
end
+
+ private
+
+ def variable_attributes_for(variables)
+ variables.map do |variable|
+ variable.to_h.tap do |hash|
+ hash[:id] = GlobalID::Locator.locate(hash[:id]).id if hash[:id]
+
+ hash[:_destroy] = hash.delete(:destroy)
+ end
+ end
+ end
end
end
end