Commit f8cb5fd6 authored by Shinya Maeda's avatar Shinya Maeda

Add own! method on PipleineSchedule

parent 8743f765
......@@ -24,6 +24,10 @@ module Ci
owner == current_user
end
def own!(user)
update!(owner: user)
end
def inactive?
!active?
end
......
......@@ -100,7 +100,7 @@ module API
pipeline_schedule = user_project.pipeline_schedules.find(params.delete(:pipeline_schedule_id))
return not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.update(owner: current_user)
if pipeline_schedule.own!(current_user)
status :ok
present pipeline_schedule, with: Entities::PipelineSchedule
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