Commit f8cb5fd6 authored by Shinya Maeda's avatar Shinya Maeda

Add own! method on PipleineSchedule

parent 8743f765
...@@ -24,6 +24,10 @@ module Ci ...@@ -24,6 +24,10 @@ module Ci
owner == current_user owner == current_user
end end
def own!(user)
update!(owner: user)
end
def inactive? def inactive?
!active? !active?
end end
......
...@@ -100,7 +100,7 @@ module API ...@@ -100,7 +100,7 @@ module API
pipeline_schedule = user_project.pipeline_schedules.find(params.delete(:pipeline_schedule_id)) pipeline_schedule = user_project.pipeline_schedules.find(params.delete(:pipeline_schedule_id))
return not_found!('PipelineSchedule') unless pipeline_schedule return not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.update(owner: current_user) if pipeline_schedule.own!(current_user)
status :ok status :ok
present pipeline_schedule, with: Entities::PipelineSchedule present pipeline_schedule, with: Entities::PipelineSchedule
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment