gitlab-org--gitlab-foss/app/services/milestones/update_service.rb
Dmitriy Zaporozhets d65bf4605e
Fix milestone reopen
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-10 19:22:39 +03:00

20 lines
518 B
Ruby

module Milestones
class UpdateService < Milestones::BaseService
def execute(milestone)
state = params.delete('state_event') || params.delete(:state_event)
case state
when 'activate'
Milestones::ReopenService.new(project, current_user, {}).execute(milestone)
when 'close'
Milestones::CloseService.new(project, current_user, {}).execute(milestone)
end
if params.present?
milestone.update_attributes(params)
end
milestone
end
end
end