diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /lib/api/ci/pipeline_schedules.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'lib/api/ci/pipeline_schedules.rb')
-rw-r--r-- | lib/api/ci/pipeline_schedules.rb | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/lib/api/ci/pipeline_schedules.rb b/lib/api/ci/pipeline_schedules.rb index 1606d5ba649..1087c734f98 100644 --- a/lib/api/ci/pipeline_schedules.rb +++ b/lib/api/ci/pipeline_schedules.rb @@ -90,28 +90,16 @@ module API post ':id/pipeline_schedules' do authorize! :create_pipeline_schedule, user_project - if ::Feature.enabled?(:ci_refactoring_pipeline_schedule_create_service, @project) - response = ::Ci::PipelineSchedules::CreateService - .new(user_project, current_user, declared_params(include_missing: false)) - .execute + response = ::Ci::PipelineSchedules::CreateService + .new(user_project, current_user, declared_params(include_missing: false)) + .execute - pipeline_schedule = response.payload + pipeline_schedule = response.payload - if response.success? - present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails - else - render_validation_error!(pipeline_schedule) - end + if response.success? + present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails else - pipeline_schedule = ::Ci::CreatePipelineScheduleService - .new(user_project, current_user, declared_params(include_missing: false)) - .execute - - if pipeline_schedule.persisted? - present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails - else - render_validation_error!(pipeline_schedule) - end + render_validation_error!(pipeline_schedule) end end @@ -135,22 +123,14 @@ module API put ':id/pipeline_schedules/:pipeline_schedule_id' do authorize! :update_pipeline_schedule, pipeline_schedule - if ::Feature.enabled?(:ci_refactoring_pipeline_schedule_create_service, @project) - response = ::Ci::PipelineSchedules::UpdateService - .new(pipeline_schedule, current_user, declared_params(include_missing: false)) - .execute + response = ::Ci::PipelineSchedules::UpdateService + .new(pipeline_schedule, current_user, declared_params(include_missing: false)) + .execute - if response.success? - present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails - else - render_validation_error!(pipeline_schedule) - end + if response.success? + present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails else - if pipeline_schedule.update(declared_params(include_missing: false)) # rubocop:disable Style/IfInsideElse - present pipeline_schedule, with: Entities::Ci::PipelineScheduleDetails - else - render_validation_error!(pipeline_schedule) - end + render_validation_error!(pipeline_schedule) end end |