2018-07-17 12:50:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-06-10 11:07:52 -04:00
|
|
|
module Milestones
|
|
|
|
class UpdateService < Milestones::BaseService
|
|
|
|
def execute(milestone)
|
2014-06-26 16:24:17 -04:00
|
|
|
state = params[:state_event]
|
2014-06-10 11:07:52 -04:00
|
|
|
|
|
|
|
case state
|
2014-06-10 12:22:39 -04:00
|
|
|
when 'activate'
|
2017-07-07 11:08:49 -04:00
|
|
|
Milestones::ReopenService.new(parent, current_user, {}).execute(milestone)
|
2014-06-10 11:07:52 -04:00
|
|
|
when 'close'
|
2017-07-07 11:08:49 -04:00
|
|
|
Milestones::CloseService.new(parent, current_user, {}).execute(milestone)
|
2014-06-10 11:07:52 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if params.present?
|
2018-07-02 06:43:06 -04:00
|
|
|
milestone.update(params.except(:state_event))
|
2014-06-10 11:07:52 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
milestone
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
Milestones::UpdateService.prepend_if_ee('EE::Milestones::UpdateService')
|