Commit 1695d791 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Added Geo::DeletedProject to take place of "FakeProject" used by Geo

parent 6340e1e4
class Geo::DeletedProject < ::Project
after_initialize :readonly!
attr_reader :path_with_namespace
def initialize(id:, name:, path_with_namespace:, repository_storage: 'default')
super(id: id, name: name, repository_storage: repository_storage)
@path_with_namespace = path_with_namespace
end
def repository
@repository ||= Repository.new(path_with_namespace, self)
end
end
...@@ -5,14 +5,8 @@ class GeoRepositoryDestroyWorker ...@@ -5,14 +5,8 @@ class GeoRepositoryDestroyWorker
def perform(id, name, path_with_namespace) def perform(id, name, path_with_namespace)
# We don't have access to the original model anymore, so we are # We don't have access to the original model anymore, so we are
# rebuilding only what our service class requires # rebuilding only what our service class requires
project = FakeProject.new(id, name, path_with_namespace) project = ::Geo::DeletedProject.new(id: id, name: name, path_with_namespace: path_with_namespace)
::Projects::DestroyService.new(project, nil).geo_replicate ::Projects::DestroyService.new(project, nil).geo_replicate
end end
FakeProject = Struct.new(:id, :name, :path_with_namespace) do
def repository
@repository ||= Repository.new(path_with_namespace, self)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment