d65bf4605e
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
20 lines
518 B
Ruby
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
|