Geo - Fix path_with_namespace for instances of Geo::DeletedProject
What does this MR do?
Makes Geo::DeletedProject#path_with_namespace
a new copy of the overriden method Geo::DeletedProject#full_path
.
Are there points in the code the reviewer needs to double check?
No.
Why was this MR needed?
The Projects::DestroyService
calls project.path_with_namespace
to build the wiki path, but alias_method
retain access to methods that were overridden. So, project.path_with_namespace
returns nil
for instances of Geo::DeletedProject
which raises an exception:
WARN: NoMethodError: undefined method `+` for nil:NilClass
WARN: gitlab/app/services/projects/destroy_service.rb:60:in `wiki_path`
- Before:
pry(main)> show-source Geo::DeletedProject#path_with_namespace
From: gitlab/app/models/concerns/routable.rb @ line 103:
Owner: Project
Visibility: public
Number of lines: 6
def full_path
return uncached_full_path unless RequestStore.active?
key = "routable/full_path/#{self.class.name}/#{self.id}"
RequestStore[key] ||= uncached_full_path
end
- After:
pry(main)> show-source Geo::DeletedProject#path_with_namespace
From: gitlab/app/models/geo/deleted_project.rb @ line 17:
Owner: Geo::DeletedProject
Visibility: public
Number of lines: 3
def full_path
@full_path
end
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #2726 (closed)