gitlab-org--gitlab-foss/app/services/milestones/update_service.rb

25 lines
609 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Milestones
class UpdateService < Milestones::BaseService
# rubocop: disable CodeReuse/ActiveRecord
def execute(milestone)
state = params[:state_event]
case state
when 'activate'
2017-07-07 15:08:49 +00:00
Milestones::ReopenService.new(parent, current_user, {}).execute(milestone)
when 'close'
2017-07-07 15:08:49 +00:00
Milestones::CloseService.new(parent, current_user, {}).execute(milestone)
end
if params.present?
2018-07-02 10:43:06 +00:00
milestone.update(params.except(:state_event))
end
milestone
end
# rubocop: enable CodeReuse/ActiveRecord
end
end