Class: Milestones::DestroyService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- Milestones::DestroyService
- Defined in:
- app/services/milestones/destroy_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #parent
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods inherited from BaseService
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from Milestones::BaseService
Instance Method Details
#execute(milestone) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/milestones/destroy_service.rb', line 5 def execute(milestone) Milestone.transaction do update_params = { milestone_id: nil, skip_milestone_email: true } milestone.issues.each do |issue| Issues::UpdateService.new(container: parent, current_user: current_user, params: update_params).execute(issue) end milestone.merge_requests.each do |merge_request| MergeRequests::UpdateService.new(project: parent, current_user: current_user, params: update_params).execute(merge_request) end log_destroy_event_for(milestone) milestone.destroy end end |
#log_destroy_event_for(milestone) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/milestones/destroy_service.rb', line 23 def log_destroy_event_for(milestone) return if milestone.group_milestone? event_service.destroy_milestone(milestone, current_user) Event.for_milestone_id(milestone.id).each do |event| event.target_id = nil event.save end end |