gitlab-org--gitlab-foss/app/services/destroy_group_service.rb
Stan Hu 4955a47cb1 Clean up project destruction
Instead of redirecting from the project service to the service and back to the model,
put all destruction code in the service. Also removes a possible source of failure
where run_after_commit may not destroy the project.
2016-08-10 09:28:21 -07:00

17 lines
439 B
Ruby

class DestroyGroupService
attr_accessor :group, :current_user
def initialize(group, user)
@group, @current_user = group, user
end
def execute
group.projects.each do |project|
# Skip repository removal because we remove directory with namespace
# that contain all this repositories
::Projects::DestroyService.new(project, current_user, skip_repo: true).async_execute
end
group.destroy
end
end