gitlab-org--gitlab-foss/app/services/milestones/update_service.rb
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00

24 lines
609 B
Ruby

# 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'
Milestones::ReopenService.new(parent, current_user, {}).execute(milestone)
when 'close'
Milestones::CloseService.new(parent, current_user, {}).execute(milestone)
end
if params.present?
milestone.update(params.except(:state_event))
end
milestone
end
# rubocop: enable CodeReuse/ActiveRecord
end
end