Geo - Fix path_with_namespace for instances of Geo::DeletedProject

Douglas Barbosa Alexandre requested to merge fix-2726 into master

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?


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

  key = "routable/full_path/#{}/#{}"
  RequestStore[key] ||= uncached_full_path
  • 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

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #2726 (closed)

Edited by Douglas Barbosa Alexandre

Merge request reports