summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2018-08-06 16:02:52 -0300
committerFelipe Artur <felipefac@gmail.com>2018-08-06 17:31:47 -0300
commitabb50ff4710e264c0c700df88757ee3ab1cf7dfb (patch)
treea77ce62f4384becfe7b36fa1ae7fea700895812f /app/services
parentcb2e07309b4e61501a44c3568155bdb73252338f (diff)
downloadgitlab-ce-abb50ff4710e264c0c700df88757ee3ab1cf7dfb.tar.gz
Allow to delete group milestonesissue_36138
Diffstat (limited to 'app/services')
-rw-r--r--app/services/milestones/destroy_service.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/app/services/milestones/destroy_service.rb b/app/services/milestones/destroy_service.rb
index 15c04525075..7cda802c120 100644
--- a/app/services/milestones/destroy_service.rb
+++ b/app/services/milestones/destroy_service.rb
@@ -3,8 +3,6 @@
module Milestones
class DestroyService < Milestones::BaseService
def execute(milestone)
- return unless milestone.project_milestone?
-
Milestone.transaction do
update_params = { milestone: nil }
@@ -16,15 +14,21 @@ module Milestones
MergeRequests::UpdateService.new(parent, current_user, update_params).execute(merge_request)
end
- event_service.destroy_milestone(milestone, current_user)
-
- Event.for_milestone_id(milestone.id).each do |event|
- event.target_id = nil
- event.save
- end
+ log_destroy_event_for(milestone)
milestone.destroy
end
end
+
+ 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
end
end