diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-19 22:24:31 +0900 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-30 23:55:09 +0900 |
commit | bfa028e13a41b16b0da2d69359694edbebf9e455 (patch) | |
tree | 61d8f8fc1870a512dc68be259d5f5344790650c1 /lib | |
parent | f6a8894a5928e1cc37d8301c555fcfd5953cc180 (diff) | |
download | gitlab-ce-bfa028e13a41b16b0da2d69359694edbebf9e455.tar.gz |
Remove deleted_at from Entity. Use find_by. Remove returns.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/pipeline_schedules.rb | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index d779cd2a294..40ef62fdb14 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -689,7 +689,7 @@ module API class PipelineSchedule < Grape::Entity expose :id expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active - expose :created_at, :updated_at, :deleted_at + expose :created_at, :updated_at expose :last_pipeline, using: Entities::PipelineBasic, if: { type: :full } expose :owner, using: Entities::UserBasic end diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb index c013d6f316b..367f6e2fbab 100644 --- a/lib/api/pipeline_schedules.rb +++ b/lib/api/pipeline_schedules.rb @@ -29,7 +29,7 @@ module API get ':id/pipeline_schedules/:pipeline_schedule_id' do authorize! :read_pipeline_schedule, user_project - return not_found!('PipelineSchedule') unless pipeline_schedule + not_found!('PipelineSchedule') unless pipeline_schedule present pipeline_schedule, with: Entities::PipelineSchedule, type: :full end @@ -72,7 +72,7 @@ module API put ':id/pipeline_schedules/:pipeline_schedule_id' do authorize! :create_pipeline_schedule, user_project - return not_found!('PipelineSchedule') unless pipeline_schedule + not_found!('PipelineSchedule') unless pipeline_schedule if pipeline_schedule.update(declared_params(include_missing: false)) present pipeline_schedule, with: Entities::PipelineSchedule, type: :full @@ -90,7 +90,7 @@ module API post ':id/pipeline_schedules/:pipeline_schedule_id/take_ownership' do authorize! :create_pipeline_schedule, user_project - return not_found!('PipelineSchedule') unless pipeline_schedule + not_found!('PipelineSchedule') unless pipeline_schedule if pipeline_schedule.own!(current_user) present pipeline_schedule, with: Entities::PipelineSchedule, type: :full @@ -108,7 +108,7 @@ module API delete ':id/pipeline_schedules/:pipeline_schedule_id' do authorize! :admin_pipeline_schedule, user_project - return not_found!('PipelineSchedule') unless pipeline_schedule + not_found!('PipelineSchedule') unless pipeline_schedule present pipeline_schedule.destroy, with: Entities::PipelineSchedule, type: :full end @@ -124,7 +124,7 @@ module API @pipeline_schedule ||= user_project.pipeline_schedules .preload([:owner, :last_pipeline]) - .find(params.delete(:pipeline_schedule_id)) + .find_by(id: params.delete(:pipeline_schedule_id)) end end end |