gitlab-org--gitlab-foss/app/services/projects/unlink_fork_service.rb

20 lines
515 B
Ruby
Raw Normal View History

2016-03-22 10:34:35 -04:00
module Projects
class UnlinkForkService < BaseService
def execute
return unless @project.forked?
@project.forked_from_project.lfs_objects.find_each do |lfs_object|
2016-04-04 10:41:01 -04:00
lfs_object.projects << @project
2016-03-22 10:34:35 -04:00
end
merge_requests = @project.forked_from_project.merge_requests.opened.from_project(@project)
merge_requests.each do |mr|
MergeRequests::CloseService.new(@project, @current_user).execute(mr)
end
@project.forked_project_link.destroy
end
end
end