debian-mirror-gitlab/app/services/milestones/update_service.rb

25 lines
591 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
module Milestones
class UpdateService < Milestones::BaseService
def execute(milestone)
state = params[:state_event]
case state
when 'activate'
2017-09-10 17:25:29 +05:30
Milestones::ReopenService.new(parent, current_user, {}).execute(milestone)
2014-09-02 18:07:02 +05:30
when 'close'
2017-09-10 17:25:29 +05:30
Milestones::CloseService.new(parent, current_user, {}).execute(milestone)
2014-09-02 18:07:02 +05:30
end
if params.present?
2018-11-18 11:00:15 +05:30
milestone.update(params.except(:state_event))
2014-09-02 18:07:02 +05:30
end
milestone
end
end
end
2019-12-04 20:38:33 +05:30
2021-06-08 01:23:25 +05:30
Milestones::UpdateService.prepend_mod_with('Milestones::UpdateService')