Commit 1f9f1706 authored by James Lopez's avatar James Lopez

fix wiki access

parent 8f6f50db
...@@ -11,7 +11,7 @@ module EE ...@@ -11,7 +11,7 @@ module EE
message = super message = super
if ::Gitlab::Geo.primary_node if ::Gitlab::Geo.primary_node
clone_url = geo_primary_default_url_to_repo(@project) clone_url = geo_primary_default_url_to_repo(project_or_wiki)
message += " Please use the Primary node URL: #{clone_url}. Documentation: #{GEO_SERVER_DOCS_URL}" message += " Please use the Primary node URL: #{clone_url}. Documentation: #{GEO_SERVER_DOCS_URL}"
end end
...@@ -22,6 +22,10 @@ module EE ...@@ -22,6 +22,10 @@ module EE
user user
end end
def project_or_wiki
self.class.name == 'Gitlab::GitAccessWiki' ? @project.wiki : @project
end
def gitlab_config def gitlab_config
::Gitlab.config.gitlab ::Gitlab.config.gitlab
end end
......
...@@ -26,7 +26,7 @@ describe Gitlab::GitAccess do ...@@ -26,7 +26,7 @@ describe Gitlab::GitAccess do
it 'denies push access with primary present' do it 'denies push access with primary present' do
error_message = "You can't push code to a read-only GitLab instance. "\ error_message = "You can't push code to a read-only GitLab instance. "\
"Please use the Primary node URL: https://localhost:3000/gitlab/namespace2/project2.git. Documentation: https://docs.gitlab.com/ee/gitlab-geo/using_a_geo_server.html" "Please use the Primary node URL: https://localhost:3000/gitlab/#{project.full_path}.git. Documentation: https://docs.gitlab.com/ee/gitlab-geo/using_a_geo_server.html"
primary_node = create(:geo_node, :primary, url: 'https://localhost:3000/gitlab') primary_node = create(:geo_node, :primary, url: 'https://localhost:3000/gitlab')
allow(Gitlab::Geo).to receive(:primary).and_return(primary_node) allow(Gitlab::Geo).to receive(:primary).and_return(primary_node)
......
...@@ -29,8 +29,8 @@ describe Gitlab::GitAccessWiki do ...@@ -29,8 +29,8 @@ describe Gitlab::GitAccessWiki do
end end
it 'denies push access with primary present' do it 'denies push access with primary present' do
error_message = "You can't push code to a read-only GitLab instance. Please use the Primary node URL:"\ error_message = "You can't push code to a read-only GitLab instance. Please use the Primary node URL: "\
" <a href=\"https://localhost:3000/gitlab/\">primary node</a>. Documentation: https://docs.gitlab.com/ee/gitlab-geo/using_a_geo_server.html" "https://localhost:3000/gitlab/#{project.full_path}.wiki.git. Documentation: https://docs.gitlab.com/ee/gitlab-geo/using_a_geo_server.html"
primary_node = create(:geo_node, :primary, url: 'https://localhost:3000/gitlab') primary_node = create(:geo_node, :primary, url: 'https://localhost:3000/gitlab')
allow(Gitlab::Geo).to receive(:primary).and_return(primary_node) allow(Gitlab::Geo).to receive(:primary).and_return(primary_node)
......
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