summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-06-28 21:28:29 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-05 18:36:19 +0900
commitd7cd3c3635bc6200cd9c8668a025826818f19a80 (patch)
tree5676b55166507e21a70b9dd358ef029ae2239679
parent691462054ff7b2833a39b183c4028e2bdd1a838e (diff)
downloadgitlab-ce-d7cd3c3635bc6200cd9c8668a025826818f19a80.tar.gz
Revert extra validation for duplication between same keys on a submit
-rw-r--r--app/services/ci/create_pipeline_schedule_service.rb30
1 files changed, 2 insertions, 28 deletions
diff --git a/app/services/ci/create_pipeline_schedule_service.rb b/app/services/ci/create_pipeline_schedule_service.rb
index 4c9cb5c66c6..cd40deb6187 100644
--- a/app/services/ci/create_pipeline_schedule_service.rb
+++ b/app/services/ci/create_pipeline_schedule_service.rb
@@ -1,39 +1,13 @@
module Ci
class CreatePipelineScheduleService < BaseService
def execute
- pipeline_schedule = project.pipeline_schedules.build(pipeline_schedule_params)
-
- if variable_keys_duplicated?
- pipeline_schedule.errors.add('variables.key', "keys are duplicated")
-
- return pipeline_schedule
- end
-
- pipeline_schedule.save
- pipeline_schedule
- end
-
- def update(pipeline_schedule)
- if variable_keys_duplicated?
- pipeline_schedule.errors.add('variables.key', "keys are duplicated")
-
- return false
- end
-
- pipeline_schedule.update(pipeline_schedule_params)
+ project.pipeline_schedules.create(pipeline_schedule_params)
end
private
def pipeline_schedule_params
- @pipeline_schedule_params ||= params.merge(owner: current_user)
- end
-
- def variable_keys_duplicated?
- attributes = pipeline_schedule_params['variables_attributes']
- return false unless attributes.is_a?(Array)
-
- attributes.map { |v| v['key'] }.uniq.length != attributes.length
+ params.merge(owner: current_user)
end
end
end